lib/Perlmazing/Perlmazing/Precompile/remove_duplicates.pm

filter: Statementstmt 14.2% 3 / 21 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 50.0% 1 / 2 Podpod n/a totaltotal 8.7% 4 / 46 CC 11 SCAR 48.0
CC
11
Cov
7%
main
132.0
BEGIN
1.0
CRAP 121.1
« blib/lib/Perlmazing/Perlmazing/truncate_text.pm ↑ Summary blib/lib/Perlmazing/Perlmazing/commify.pm »
1 30 ▶use Perlmazing qw(isa_array list_context scalar_context);
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 0 ▶sub main (\@) {
Subroutine main: not called CC=11 SCAR=48.8
4 0 my $arr = shift;
5 0 ▶ $arr = [$arr, @_] unless isa_array $arr;
Branch: 1 branch
BranchTrueFalseTotal
unless &isa_array($arr) 0 0 0
6 0 my @copy = @$arr;
7 0 my @duplicates;
8 my $seen;
9 0 my $undef = undef;
10 0 $undef = bless \$undef, 'undef';
11 0 ▶ for (my $i = 0; $i < @copy; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @copy) 0 0 0
12 0 ▶ $copy[$i] = $undef if not defined $copy[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $copy[$i] 0 0 0
13 0 ▶ if ($seen->{$copy[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$seen{$copy[$i]}) { } 0 0 0
14 0 push @duplicates, splice @copy, $i, 1;
15 0 $i--;
16 } else {
17 0 $seen->{$copy[$i]} = 1;
18 }
19 }
20 0 for my $i (@copy) {
21 0 ▶ $i = undef if ref($i) and ref($i) eq 'undef' and $i eq $undef;
Branch: 1 branch
BranchTrueFalseTotal
if ref $i and ref $i eq "undef" and $i eq $undef 0 0 0
Condition0%0/6
ref $i and ref $i eq "undef" and $i eq $undef
!ll&&!rl&&r
000
ref $i and ref $i eq "undef"
!ll&&!rl&&r
000
MC/DC0%0/3
ref $i and ref $i eq "undef" and $i eq $undef
ref $i ref $i eq "undef" $i eq $undef
Truth table0%0/4
A and B and C
A= ref $iB= ref $i eq "undef"C= $i eq $undef
ABCresult
0XX0
10X0
1100
1111
22 }
23 0 ▶ if (list_context()) {
Branch: 2 branches
BranchTrueFalseTotal
if (&list_context()) { } 0 0 0
elsif (&scalar_context()) { } 0 0 0
24 0 return @copy;
25 } elsif (scalar_context()) {
26 0 return scalar @duplicates;
27 } else {
28 0 @$arr = @copy;
29 }
30 }
31  
« blib/lib/Perlmazing/Perlmazing/truncate_text.pm ↑ Summary blib/lib/Perlmazing/Perlmazing/commify.pm »