Indexer/Format.pm

filter: Statementstmt 97.4% 38 / 39 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 75.0% 51 / 68 CC 9 SCAR 20.5
CC
9
Cov
80%
index_distribution
11.5
BEGIN
1.0
BEGIN
1.0
CRAP 7.8
« Indexer/Format/SQLite.pm ↑ Summary Indexer.pm »
1 package DarkPAN::Indexer::Format;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use English qw(-no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Dist::Metadata;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 5 requires 'create_index';
12  
13 5 requires 'update_index';
14  
15 5 requires 'load_index';
16  
17 5 requires 'delete_from_index';
18  
19 5 requires 'new';
20  
21 ########################################################################
22 8 ▶sub index_distribution {
Subroutine index_distribution: called CC=9 SCAR=24.4
Pod undocumented
23 ########################################################################
24 8 my ( $self, %args ) = @_;
25  
26 8 my ( $output_fh, $distribution, $fetch ) = @args{qw(output_fh distribution fetch)};
27  
28 8 my $archive_file = $fetch->($distribution);
29  
30 7 my $metadata = Dist::Metadata->new( file => $archive_file, );
31  
32 7 my $distribution_version = $metadata->version();
33 7 my $package_versions = $metadata->package_versions();
34  
35 7 ▶ die "unable to determine distribution version\n"
Branch: 1 branch
BranchTrueFalseTotal
if not defined $distribution_version or $distribution_version eq "" 0 7 7
Condition33%1/3
not defined $distribution_version or $distribution_version eq ""
l!l&&r!l&&!r
007
MC/DC0%0/2
not defined $distribution_version or $distribution_version eq ""
not defined $distribution_version $distribution_version eq ""
Truth table33%1/3
not(A) or B
A= not defined $distribution_versionB= $distribution_version eq ""
ABresult
1X1
011
000
36 if !defined $distribution_version || $distribution_version eq q{};
37  
38 7 ▶ die "unable to determine packages provided by distribution\n"
Branch: 1 branch
BranchTrueFalseTotal
if ref $package_versions ne "HASH" 0 7 7
39 if ref $package_versions ne 'HASH';
40  
41 7 my $module_count = 0;
42  
43 7 for my $module_name ( keys %{$package_versions} ) {
44 7 my $module_version = $package_versions->{$module_name};
45  
46 7 ▶ if ( !defined $module_version || $module_version eq q{} || $module_version eq '0' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $module_version or $module_version eq "" or $module_version eq 0) 0 7 7
Condition33%2/6
not defined $module_version or $module_version eq "" or $module_version eq 0
l!l&&r!l&&!r
007
not defined $module_version or $module_version eq ""
l!l&&r!l&&!r
007
MC/DC0%0/3
not defined $module_version or $module_version eq "" or $module_version eq 0
not defined $module_version $module_version eq "" $module_version eq 0
Truth table25%1/4
not(A) or B or C
A= not defined $module_versionB= $module_version eq ""C= $module_version eq 0
ABCresult
1XX1
01X1
0011
0000
47 0 $module_version = $distribution_version;
48 }
49  
50 7 ▶ print {$output_fh} join( "\t", $distribution, $module_name, $module_version, ), "\n"
Branch: 1 branch
BranchTrueFalseTotal
print {$output_fh;} join("\t", $distribution, $module_name, $module_version), "\n" or die sprintf("unable to write index record: %s\n", $DarkPAN::Indexer::Format::OS_ERROR) 7 0 7
51 or die sprintf "unable to write index record: %s\n", $OS_ERROR,;
52  
53 7 $module_count++;
54 }
55  
56 7 return $module_count;
57 }
58  
59 5 1;
« Indexer/Format/SQLite.pm ↑ Summary Indexer.pm »