| 1 | package Mogura::Protocol; | ||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use POSIX qw(strftime); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 8 | our @EXPORT_OK = qw(random_id valid_id now artifact_name); | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 78 | ▶ | sub random_id { | ||||||||||||||||||||||||||
|
Subroutine
random_id: called CC=3 SCAR=11.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | 78 | ▶ | open my $fh, '<:raw', '/dev/urandom' or die "random: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 10 | 78 | ▶ | read($fh, my $bytes, 16) == 16 or die 'Random source unavailable'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 11 | 78 | return unpack('H*', $bytes); | |||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||
| 13 | 206 | ▶ | sub now { strftime('%Y-%m-%dT%H:%M:%SZ', gmtime) } | ||||||||||||||||||||||||||
|
Subroutine
now: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 1022 | ▶ | sub valid_id { defined $_[0] && !ref($_[0]) && $_[0] =~ /\A[0-9a-f]{32}\z/ } | ||||||||||||||||||||||||||
|
Subroutine
valid_id: called CC=3 SCAR=14.2
Pod
undocumented
Branch: 1 branch
Condition33%1/3
defined $_[0] and not ref $_[0]
MC/DC0%0/2
defined $_[0] and not ref $_[0]
defined $_[0]
not ref $_[0]
Truth table33%1/3
A and not(B)
A= defined $_[0]B= not ref $_[0]
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 198 | ▶ | sub artifact_name { | ||||||||||||||||||||||||||
|
Subroutine
artifact_name: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 17 | 198 | my %files = ( | |||||||||||||||||||||||||||
| 18 | syft => 'sbom.syft.json', | ||||||||||||||||||||||||||||
| 19 | cdx => 'sbom.cdx.json', | ||||||||||||||||||||||||||||
| 20 | grype => 'vulnerabilities.grype.json', | ||||||||||||||||||||||||||||
| 21 | log => 'scan.log' | ||||||||||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||||||||||
| 23 | 198 | ▶ | return $files{$_[0] // ''}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$_[0] // ""
MC/DC0%0/1
$_[0] // ""
$_[0]
Truth table50%1/2
A
A= $_[0]
| |||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | 8 | 1; | |||||||||||||||||||||||||||