CPE
view release on metacpan or search on metacpan
my %data = %+;
foreach my $k (keys %data) {
if ($data{$k} eq '') {
$data{$k} = 'ANY';
}
elsif ($data{$k} eq '-') {
$data{$k} = 'NA';
}
elsif ($data{$k} =~ /\%/) {
# URI CPEs may have percent-encoded special characters
# which must be decoded to proper values.
my %decoded = (
'21' => '!', '22' => '"', '23' => '#', '24' => '$',
'25' => '%', '26' => '&', '27' => q('), '28' => '(',
'29' => ')', '2a' => '*', '2b' => '+', '2c' => ',',
'2f' => '/', '3a' => ':', '3b' => ';', '3c' => '<',
'3d' => '=', '3e' => '>', '3f' => '?', '40' => '@',
'5b' => '[', '5c' => '\\', '5d' => ']', '5e' => '^',
'60' => '`', '7b' => '{', '7c' => '|', '7d' => '}',
'7e' => '~',
);
$data{$k} =~ s{\%01}{?}g if index($data{$k}, '%01') >= 0;
$data{$k} =~ s{\%02}{*}g if index($data{$k}, '%02') >= 0;
foreach my $special (keys %decoded) {
if (index($data{$k}, '%' . $special) >= 0) {
$data{$k} =~ s{\%$special}{\\$decoded{$special}}ig;
}
}
}
}
# this is a compatibility layer between CPE 2.2 and 2.3.
# URIs using 2.3 format will have the 'edition' field starting
# with a '~' and with '~' dividing all the new 2.3 fields within.
# In 2.2 this is not done, and those fields don't exist.
if (defined $data{edition} && substr($data{edition}, 0, 1) eq '~') {
(undef,
( run in 1.271 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )