lib/Hash/MostUtils/leach.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 4 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 42 / 42 SCAR 13.9
CC
4
Cov
100%
_n_each
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« blib/lib/Hash/MostUtils/leach/v5_10.pm ↑ Summary blib/lib/Hash/MostUtils/leach/v5_08.pm »
1 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Hash::MostUtils::leach;
4  
5 use provide (
6 10 if => ge => 5.013 => 'Hash::MostUtils::leach::v5_13',
7 else => 'Hash::MostUtils::leach::v5_10',
8 10 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 10 ▶use Scalar::Util qw(refaddr);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 {
13 10 my %end;
14  
15 # n-ary each for lists
16 sub _n_each {
17 80 ▶ my $n = shift;
Subroutine _n_each: called CC=4 SCAR=13.9
18 80 my $data = shift;
19  
20 80 my $ident = refaddr($data);
21  
22 # does it look hashlike? cast to an array ref for indexing.
23 $data = [ %$data ] if
24 80 ▶ do { local $@; eval { scalar keys %$data; 1 } };
Branch: 1 branch
BranchTrueFalseTotal
if do { local $@; eval { do { scalar keys %$data; 1 } } } 47 33 80
25  
26 80 ▶ if ($#{$data} < ($end{$ident} || 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#{$data;} < ($end{$ident} || 0)) 14 65 79
Condition100%2/2
$end{$ident} || 0
l!l
6514
MC/DC100%1/1
$end{$ident} || 0
$end{$ident}
Truth table100%2/2
A
A= $end{$ident}
Aresult
11
00
27 14 delete $end{$ident};
28 14 return ();
29 }
30  
31 65 $end{$ident} += $n;
32 65 return @{$data}[$end{$ident} - $n .. $end{$ident} - 1];
33 }
34 }
35  
36 10 1;
37  
38 __END__
« blib/lib/Hash/MostUtils/leach/v5_10.pm ↑ Summary blib/lib/Hash/MostUtils/leach/v5_08.pm »