Create/OrderBy/Dist.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 90.7% 39 / 43 CC 5 SCAR 8.5
CC
5
Cov
97%
add_file
3.0
finish
3.0
BEGIN
1.0
CRAP 2.3
« Create/OrderBy/Author.pm ↑ Summary Create/OrderBy/Age.pm »
1 package BackPAN::Index::Create::OrderBy::Dist;
2 2 $BackPAN::Index::Create::OrderBy::Dist::VERSION = '0.13';
3 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use CPAN::DistnameInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 has filehandle => (is => 'ro');
7 2 ▶has entries => (is => 'ro', default => sub { return {} });
Subroutine __ANON__: called CC=1 SCAR=0.0
8  
9 sub add_file
10 8 ▶{
Subroutine add_file: called CC=3 SCAR=11.0
Pod undocumented
11 8 my $self = shift;
12 8 my ($path, $time, $size) = @_;
13 8 my $distinfo = CPAN::DistnameInfo->new($path);
14 8 my $entries = $self->entries;
15 8 my $distname;
16  
17 8 ▶ if (!defined($distinfo) || !defined($distname = $distinfo->dist)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $distinfo and defined($distname = $distinfo->dist)) 4 4 8
Condition66%2/3
defined $distinfo and defined($distname = $distinfo->dist)
!ll&&!rl&&r
044
MC/DC50%1/2
defined $distinfo and defined($distname = $distinfo->dist)
defined $distinfo defined($distname = $distinfo->dist)
Truth table66%2/3
A and B
A= defined $distinfoB= defined($distname = $distinfo->dist)
ABresult
0X0
100
111
18 4 $distname = '';
19 }
20 8 push(@{ $entries->{$distname} }, [$path,$time,$size] );
21 }
22  
23 sub finish
24 2 ▶{
Subroutine finish: called CC=3 SCAR=11.0
Pod undocumented
25 2 my $self = shift;
26 2 my $entries = $self->entries;
27 2 my $fh = $self->filehandle;
28  
29 2 foreach my $distname (sort { lc($a) cmp lc($b) } keys %$entries) {
30 5 foreach my $entry (sort { $a->[1] <=> $b->[1] }
31 5 @{ $entries->{$distname} }) {
32 8 printf $fh "%s %d %d\n", @$entry;
33 }
34 }
35 }
36  
37 2 1;
« Create/OrderBy/Author.pm ↑ Summary Create/OrderBy/Age.pm »