lib/CPAN/Audit/Discover/CpanfileSnapshot.pm

filter: Statementstmt 42.3% 11 / 26 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 29.1% 14 / 48 CC 7 SCAR 35.9
CC
7
Cov
28%
discover
56.0
new
2.0
BEGIN
1.0
CRAP 36.1
↑ Summary lib/CPAN/Audit.pm »
1 package CPAN::Audit::Discover::CpanfileSnapshot;
2 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use CPAN::DistnameInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 13 our $VERSION = "1.001";
7  
8 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
9 0 my $class = shift;
10  
11 0 my $self = {};
12 0 bless $self, $class;
13  
14 0 return $self;
15 }
16  
17 0 ▶sub discover {
Subroutine discover: not called CC=7 SCAR=40.3
Pod undocumented
18 0 my $self = shift;
19 0 my ($cpanfile_snapshot_path) = @_;
20  
21 0 ▶ open my $fh, '<', $cpanfile_snapshot_path or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $cpanfile_snapshot_path or die $! 0 0 0
22  
23 0 my @deps;
24 0 ▶ while ( defined( my $line = <$fh> ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $fh)) 0 0 0
25 0 ▶ if ( $line =~ m/pathname: ([^\s]+)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /pathname: ([^\s]+)/) 0 0 0
26 0 ▶ next unless my $d = CPAN::DistnameInfo->new($1);
Branch: 1 branch
BranchTrueFalseTotal
unless my $d = "CPAN::DistnameInfo"->new($1) 0 0 0
27  
28 0 ▶ next unless $d->dist && $d->version;
Branch: 1 branch
BranchTrueFalseTotal
unless $d->dist and $d->version 0 0 0
Condition0%0/3
$d->dist and $d->version
!ll&&!rl&&r
000
MC/DC0%0/2
$d->dist and $d->version
$d->dist $d->version
Truth table0%0/3
A and B
A= $d->distB= $d->version
ABresult
0X0
100
111
29  
30 0 push @deps,
31 {
32 dist => $d->dist,
33 version => $d->version,
34 };
35 }
36 }
37  
38 0 close $fh;
39  
40 0 return @deps;
41 }
42  
43 13 1;
↑ Summary lib/CPAN/Audit.pm »