« 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | $copy[$i] = $undef if not defined $copy[$i]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | if ($seen->{$copy[$i]}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition0%0/6
ref $i and ref $i eq "undef" and $i eq $undef
ref $i and ref $i eq "undef"
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
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | if (list_context()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | return @copy; | |||||||||||||||||||||||||||||||||||||||||
| 25 | } elsif (scalar_context()) { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | return scalar @duplicates; | |||||||||||||||||||||||||||||||||||||||||
| 27 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | @$arr = @copy; | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||