| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | package Net::CVE; | ||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use 5.014002; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | 6 | our $VERSION = "0.010"; | |||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use HTTP::Tiny; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use JSON::MaybeXS; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use List::Util qw( first ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | # https://cveawg.mitre.org/api/cve/CVE-2022-26928 | ||||||||||||||||||||||||||||||||
| 16 | # But that is likely to change to cve.org | ||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | sub Version { $VERSION } | ||||||||||||||||||||||||||||||
|
Subroutine
Version: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 21 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 21 | 21 | my $class = shift; | |||||||||||||||||||||||||||||||
| 22 | 21 | my %r = ( | |||||||||||||||||||||||||||||||
| 23 | url => "https://cveawg.mitre.org/api/cve", | ||||||||||||||||||||||||||||||||
| 24 | ua => undef, | ||||||||||||||||||||||||||||||||
| 25 | lang => "en", | ||||||||||||||||||||||||||||||||
| 26 | data => {}, | ||||||||||||||||||||||||||||||||
| 27 | diag => undef, | ||||||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||||||
| 29 | 21 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 30 | 6 | ▶ | if (@_ == 1 && ref $_[0] eq "HASH") { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC50%1/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||
| 31 | 1 | $r{$_} = $_[0]{$_} for keys %{$_[0]}; | |||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||
| 33 | elsif (@_ == 2) { | ||||||||||||||||||||||||||||||||
| 34 | 5 | my %p = @_; | |||||||||||||||||||||||||||||||
| 35 | 5 | $r{$_} = $p{$_} for keys %p; | |||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||
| 38 | 21 | bless \%r => $class; | |||||||||||||||||||||||||||||||
| 39 | } # new | ||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | 5 | ▶ | sub diag { | ||||||||||||||||||||||||||||||
|
Subroutine
diag: called CC=7 SCAR=28.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 42 | 5 | ▶ | my $self = shift or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 43 | 5 | ▶ | ref $self or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 44 | 5 | ▶ | my $d = $self->{diag} or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 45 | 5 | ▶ | unless (defined wantarray) { # void context | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 46 | 0 | my $act = $d->{action}; | |||||||||||||||||||||||||||||||
| 47 | warn "$act: ", | ||||||||||||||||||||||||||||||||
| 48 | 0 | (join " " => grep { length } $d->{status}, $d->{reason}), "\n"; | |||||||||||||||||||||||||||||||
| 49 | 0 | $act =~ s/./ /g; | |||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | warn "$act source = $d->{source}\n" if $d->{source}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | warn "$act usage: $d->{usage}\n" if $d->{usage}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||
| 53 | 5 | return $d; | |||||||||||||||||||||||||||||||
| 54 | } # diag | ||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 21 | ▶ | sub get { | ||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=10 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 57 | 21 | my ($self, $cve) = @_; | |||||||||||||||||||||||||||||||
| 58 | 21 | ▶ | ref $self or $self = __PACKAGE__->new (); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 59 | 21 | $self->{data} = {}; | |||||||||||||||||||||||||||||||
| 60 | 21 | $self->{diag} = undef; | |||||||||||||||||||||||||||||||
| 61 | 21 | ▶ | $cve or return $self; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 62 | 20 | $cve =~ s/^(?=[0-9])/CVE-/; | |||||||||||||||||||||||||||||||
| 63 | 20 | ▶ | if ($cve =~ m/^CVE-[0-9]{4}-([0-9]+)$/) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 64 | 5 | ▶ | $self->{ua} //= HTTP::Tiny->new (); | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"ua"} //= "HTTP::Tiny"->new
MC/DC0%0/2
$self->{"ua"} //= "HTTP::Tiny"->new
$self->{"ua"}
"HTTP::Tiny"->new
Truth table33%1/3
A //= B
A= $self->{"ua"}B= "HTTP::Tiny"->new
| |||||||||||||||||||||||||||||||||
| 65 | 5 | my $url = join "/" => $self->{url}, $cve; | |||||||||||||||||||||||||||||||
| 66 | 5 | my $r = $self->{ua}->get ($url); | |||||||||||||||||||||||||||||||
| 67 | 5 | ▶ | unless ($r->{success}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 68 | # if pseudo-HTTP status code 599 and reason "Internal Exception" | ||||||||||||||||||||||||||||||||
| 69 | # the content field will contain the text of the error | ||||||||||||||||||||||||||||||||
| 70 | 1 | my $status = $r->{status}; | |||||||||||||||||||||||||||||||
| 71 | 2 | ▶ | my $reason = join ": " => grep { length } | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 72 | 1 | $r->{reason}, $status =~ m/^5[0-9][0-9]$/ ? $r->{content} : ""; | |||||||||||||||||||||||||||||||
| 73 | $self->{diag} = { | ||||||||||||||||||||||||||||||||
| 74 | 1 | status => $status, | |||||||||||||||||||||||||||||||
| 75 | reason => $reason, | ||||||||||||||||||||||||||||||||
| 76 | action => "get", | ||||||||||||||||||||||||||||||||
| 77 | source => $url, | ||||||||||||||||||||||||||||||||
| 78 | usage => undef, | ||||||||||||||||||||||||||||||||
| 79 | }; | ||||||||||||||||||||||||||||||||
| 80 | 1 | return $self; | |||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||
| 82 | 4 | $self->{data} = decode_json ($r->{content}); | |||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||
| 84 | elsif (-s $cve) { | ||||||||||||||||||||||||||||||||
| 85 | 14 | my $fh; | |||||||||||||||||||||||||||||||
| 86 | 14 | ▶ | unless (open $fh, "<:encoding(utf-8)", $cve) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 87 | $self->{diag} = { | ||||||||||||||||||||||||||||||||
| 88 | 2 | status => 0 + $!, | |||||||||||||||||||||||||||||||
| 89 | reason => "$!", | ||||||||||||||||||||||||||||||||
| 90 | action => "get", | ||||||||||||||||||||||||||||||||
| 91 | source => $cve, | ||||||||||||||||||||||||||||||||
| 92 | usage => 'get ("cve-2022-26928.json")', | ||||||||||||||||||||||||||||||||
| 93 | }; | ||||||||||||||||||||||||||||||||
| 94 | 2 | return $self; | |||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||
| 96 | 12 | ▶ | unless (eval { $self->{data} = decode_json (do { local $/; <$fh> }); 1 }) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 97 | $self->{diag} = { | ||||||||||||||||||||||||||||||||
| 98 | 2 | status => -2, | |||||||||||||||||||||||||||||||
| 99 | reason => $@ =~ s{\s+at\s+\S+\s+line\s+\d+.*}{}rs, | ||||||||||||||||||||||||||||||||
| 100 | action => "decode_json", | ||||||||||||||||||||||||||||||||
| 101 | source => $cve, | ||||||||||||||||||||||||||||||||
| 102 | usage => undef, | ||||||||||||||||||||||||||||||||
| 103 | }; | ||||||||||||||||||||||||||||||||
| 104 | 2 | return $self; | |||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||
| 106 | 10 | close $fh; | |||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||
| 108 | else { | ||||||||||||||||||||||||||||||||
| 109 | #warn "Invalid CVE format: '$cve' - expected format CVE-2023-12345\n"; | ||||||||||||||||||||||||||||||||
| 110 | $self->{diag} = { | ||||||||||||||||||||||||||||||||
| 111 | 1 | status => -1, | |||||||||||||||||||||||||||||||
| 112 | reason => "Invalid CVE format: '$cve'", | ||||||||||||||||||||||||||||||||
| 113 | action => "get", | ||||||||||||||||||||||||||||||||
| 114 | source => "tag", | ||||||||||||||||||||||||||||||||
| 115 | usage => 'get ("CVE-2022-26928")', | ||||||||||||||||||||||||||||||||
| 116 | }; | ||||||||||||||||||||||||||||||||
| 117 | 1 | return $self; | |||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||
| 119 | 14 | $self; | |||||||||||||||||||||||||||||||
| 120 | } # get | ||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||
| 122 | 8 | ▶ | sub data { | ||||||||||||||||||||||||||||||
|
Subroutine
data: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 123 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||
| 124 | 8 | ▶ | ref $self or $self = __PACKAGE__->new (); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 125 | 8 | ▶ | @_ and $self->get (@_); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 126 | 8 | $self->{data}; | |||||||||||||||||||||||||||||||
| 127 | } # data | ||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||
| 129 | 10 | ▶ | sub summary { | ||||||||||||||||||||||||||||||
|
Subroutine
summary: called CC=19 SCAR=30.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 130 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||
| 131 | 10 | ▶ | ref $self or $self = __PACKAGE__->new (); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 132 | 10 | ▶ | @_ and $self->get (@_); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 133 | 10 | ▶ | my $j = $self->{data} or croak "summary only available after get"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 134 | 10 | ▶ | my $cna = $j->{containers}{cna} or return +{}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 135 | #y $weak = ... weaknesses [{ description [{ lang => "en", value => "CWE-123"}] | ||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||
| 137 | 10 | ▶ | my $severity = join ", " => grep { length } map { $_->{cvssV3_1}{baseSeverity} } @{$cna->{metrics} || []}; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$cna->{'metrics'} || []
MC/DC0%0/1
$cna->{'metrics'} || []
$cna->{'metrics'}
Truth table50%1/2
A
A= $cna->{'metrics'}
| |||||||||||||||||||||||||||||||||
| 138 | 10 | ▶ | my $score = join ", " => grep { length } map { $_->{cvssV3_1}{baseScore} } @{$cna->{metrics} || []}; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$cna->{'metrics'} || []
MC/DC0%0/1
$cna->{'metrics'} || []
$cna->{'metrics'}
Truth table50%1/2
A
A= $cna->{'metrics'}
| |||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||
| 140 | 10 | my %desc; | |||||||||||||||||||||||||||||||
| 141 | 10 | ▶ | for (@{$cna->{descriptions} || []}) { | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$cna->{'descriptions'} || []
MC/DC0%0/1
$cna->{'descriptions'} || []
$cna->{'descriptions'}
Truth table50%1/2
A
A= $cna->{'descriptions'}
| |||||||||||||||||||||||||||||||||
| 142 | 30 | ▶ | my $d = $_->{value} or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 143 | 30 | push @{$desc{$_->{lang}}} => $d; | |||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||
| 145 | 10 | my @lang = sort keys %desc; | |||||||||||||||||||||||||||||||
| 146 | 10 | ▶ | my $lang = first { m/\b $self->{lang} /ix } @lang; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 147 | 10 | ▶ | $lang //= first { m/\b en /ix } @lang; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$lang //= &first(sub {
/\b en /iux;
}
, @lang)
MC/DC0%0/2
$lang //= &first(sub {
/\b en /iux;
}
, @lang)
$lang
&first(sub {
/\b en /iux;
}
, @lang)
Truth table66%2/3
A //= B
A= $langB= &first(sub {
/\b en /iux;
}
, @lang)
| |||||||||||||||||||||||||||||||||
| 148 | 10 | ▶ | $lang //= $lang[0]; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$lang //= $lang[0]
MC/DC0%0/2
$lang //= $lang[0]
$lang
$lang[0]
Truth table33%1/3
A //= B
A= $langB= $lang[0]
| |||||||||||||||||||||||||||||||||
| 149 | 10 | my $desc = join "\n" => @{$desc{$lang}}; | |||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||
| 151 | 10 | my %problem; | |||||||||||||||||||||||||||||||
| 152 | 10 | ▶ | for (map { @{$_->{descriptions} || []} } @{$cna->{problemTypes} || []}) { | ||||||||||||||||||||||||||||||
|
Condition50%2/4
$_->{'descriptions'} || []
$cna->{'problemTypes'} || []
MC/DC0%0/1
$_->{'descriptions'} || []
$_->{'descriptions'}
MC/DC0%0/1
$cna->{'problemTypes'} || []
$cna->{'problemTypes'}
Truth table50%1/2
A
A= $_->{'descriptions'}
Truth table50%1/2
A
A= $cna->{'problemTypes'}
| |||||||||||||||||||||||||||||||||
| 153 | 22 | ▶ | my $d = $_->{description} or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 154 | 22 | push @{$problem{$_->{lang}}} => $d; | |||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||
| 156 | 10 | @lang = sort keys %problem; | |||||||||||||||||||||||||||||||
| 157 | 10 | ▶ | $lang = first { m/\b $self->{lang} /ix } @lang; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 158 | 10 | ▶ | $lang //= first { m/\b en /ix } @lang; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$lang //= &first(sub {
/\b en /iux;
}
, @lang)
MC/DC50%1/2
$lang //= &first(sub {
/\b en /iux;
}
, @lang)
$lang
&first(sub {
/\b en /iux;
}
, @lang)
Truth table66%2/3
A //= B
A= $langB= &first(sub {
/\b en /iux;
}
, @lang)
| |||||||||||||||||||||||||||||||||
| 159 | 10 | ▶ | $lang //= $lang[0]; | ||||||||||||||||||||||||||||||
|
Condition66%2/3
$lang //= $lang[0]
MC/DC0%0/2
$lang //= $lang[0]
$lang
$lang[0]
Truth table66%2/3
A //= B
A= $langB= $lang[0]
| |||||||||||||||||||||||||||||||||
| 160 | 10 | ▶ | my $problem = defined $lang ? join "\n" => @{$problem{$lang}} : ""; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||
| 162 | { id => $j->{cveMetadata}{cveId}, | ||||||||||||||||||||||||||||||||
| 163 | date => $j->{cveMetadata}{datePublished}, | ||||||||||||||||||||||||||||||||
| 164 | 10 | description => $desc, | |||||||||||||||||||||||||||||||
| 165 | severity => lc $severity, | ||||||||||||||||||||||||||||||||
| 166 | score => $score, | ||||||||||||||||||||||||||||||||
| 167 | problem => $problem, | ||||||||||||||||||||||||||||||||
| 168 | product => [ $self->product ], | ||||||||||||||||||||||||||||||||
| 169 | vendor => [ $self->vendor ], | ||||||||||||||||||||||||||||||||
| 170 | platforms => [ $self->platforms ], | ||||||||||||||||||||||||||||||||
| 171 | status => $self->status, | ||||||||||||||||||||||||||||||||
| 172 | }; | ||||||||||||||||||||||||||||||||
| 173 | } # summary | ||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||
| 175 | 10 | ▶ | sub status { | ||||||||||||||||||||||||||||||
|
Subroutine
status: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 176 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||
| 177 | 10 | ▶ | @_ and $self->get (@_); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 178 | 10 | ▶ | my $j = $self->{data} or croak "status only available after get"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 179 | 10 | $j->{cveMetadata}{state}; | |||||||||||||||||||||||||||||||
| 180 | } # status | ||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||
| 182 | 20 | ▶ | sub _affected_tag { | ||||||||||||||||||||||||||||||
|
Subroutine
_affected_tag: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||||||
| 183 | 20 | my ($self, $tag) = @_; | |||||||||||||||||||||||||||||||
| 184 | 20 | ▶ | my $j = $self->{data} or croak "$tag only available after get"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 185 | 20 | ▶ | my $cna = $j->{containers}{cna} or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 186 | 20 | ▶ | my %v = map { $_->{$tag} => 1 } @{$cna->{affected} || []}; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$cna->{'affected'} || []
MC/DC0%0/1
$cna->{'affected'} || []
$cna->{'affected'}
Truth table50%1/2
A
A= $cna->{'affected'}
| |||||||||||||||||||||||||||||||||
| 187 | 20 | my @v = sort keys %v; | |||||||||||||||||||||||||||||||
| 188 | 20 | ▶ | return wantarray ? @v : join ", " => @v; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 189 | } # _affected_tag | ||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||
| 191 | 10 | ▶ | sub _affected_tag_a { | ||||||||||||||||||||||||||||||
|
Subroutine
_affected_tag_a: called CC=6 SCAR=18.7
| |||||||||||||||||||||||||||||||||
| 192 | 10 | my ($self, $tag) = @_; | |||||||||||||||||||||||||||||||
| 193 | 10 | ▶ | my $j = $self->{data} or croak "$tag only available after get"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 194 | 10 | ▶ | my $cna = $j->{containers}{cna} or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 195 | 139 | ▶ | my %v = map { $_ => 1 } map { @{$_ || []} } map { $_->{$tag} } | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$_ || []
MC/DC0%0/1
$_ || []
$_
Truth table50%1/2
A
A= $_
| |||||||||||||||||||||||||||||||||
| 196 | 10 | ▶ | @{$cna->{affected} || []}; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$cna->{'affected'} || []
MC/DC0%0/1
$cna->{'affected'} || []
$cna->{'affected'}
Truth table50%1/2
A
A= $cna->{'affected'}
| |||||||||||||||||||||||||||||||||
| 197 | 10 | my @v = sort keys %v; | |||||||||||||||||||||||||||||||
| 198 | 10 | ▶ | return wantarray ? @v : join ", " => @v; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 199 | } # _affected_tag_a | ||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||
| 201 | 10 | ▶ | sub platforms { | ||||||||||||||||||||||||||||||
|
Subroutine
platforms: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 202 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||
| 203 | 10 | ▶ | @_ and $self->get (@_); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 204 | 10 | $self->_affected_tag_a ("platforms"); | |||||||||||||||||||||||||||||||
| 205 | } # platforms | ||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | 10 | ▶ | sub vendor { | ||||||||||||||||||||||||||||||
|
Subroutine
vendor: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 208 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||
| 209 | 10 | ▶ | @_ and $self->get (@_); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 210 | 10 | $self->_affected_tag ("vendor"); | |||||||||||||||||||||||||||||||
| 211 | } # vendor | ||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||
| 213 | 10 | ▶ | sub product { | ||||||||||||||||||||||||||||||
|
Subroutine
product: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 214 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||
| 215 | 10 | ▶ | @_ and $self->get (@_); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 216 | 10 | $self->_affected_tag ("product"); | |||||||||||||||||||||||||||||||
| 217 | } # vendor | ||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||
| 219 | 6 | 1; | |||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||
| 221 | __END__ | ||||||||||||||||||||||||||||||||