Create/OrderBy/Author.pm

filter: Statementstmt 93.1% 27 / 29 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 79.0% 34 / 43 CC 5 SCAR 8.8
CC
5
Cov
85%
add_file
3.2
finish
3.0
BEGIN
1.0
CRAP 2.4
« Create.pm ↑ Summary Create/OrderBy/Dist.pm »
1 package BackPAN::Index::Create::OrderBy::Author;
2 2 $BackPAN::Index::Create::OrderBy::Author::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 4 ▶{
Subroutine add_file: called CC=3 SCAR=11.7
Pod undocumented
11 4 my $self = shift;
12 4 my ($path, $time, $size) = @_;
13 4 my $distinfo = CPAN::DistnameInfo->new($path);
14 4 my $entries = $self->entries;
15 4 my $author;
16  
17 4 ▶ if (!defined($distinfo) || !defined($author = $distinfo->cpanid)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $distinfo and defined($author = $distinfo->cpanid)) 0 4 4
Condition33%1/3
defined $distinfo and defined($author = $distinfo->cpanid)
!ll&&!rl&&r
004
MC/DC0%0/2
defined $distinfo and defined($author = $distinfo->cpanid)
defined $distinfo defined($author = $distinfo->cpanid)
Truth table33%1/3
A and B
A= defined $distinfoB= defined($author = $distinfo->cpanid)
ABresult
0X0
100
111
18 0 $author = '';
19 }
20 4 push(@{ $entries->{$author} }, [$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 $author (sort { lc($a) cmp lc($b) } keys %$entries) {
30 0 foreach my $entry (sort { $a->[1] <=> $b->[1] }
31 4 @{ $entries->{$author} }) {
32 4 printf $fh "%s %d %d\n", @$entry;
33 }
34 }
35 }
36  
37 2 1;
« Create.pm ↑ Summary Create/OrderBy/Dist.pm »