blib/lib/List/Extract.pm

filter: Statementstmt 100% 22 / 22 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 29 / 29 CC 3 SCAR 6.9
CC
3
Cov
100%
extract
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
↑ Summary
1 package List::Extract;
2 4 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 4 $VERSION = 0.03;
5  
6 4 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 @ISA = Exporter::;
8 4 @EXPORT_OK = qw/ extract /;
9 4 $EXPORT_TAGS{ALL} = \@EXPORT_OK;
10  
11 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 8 ▶sub extract (&\@) {
Subroutine extract: called CC=3 SCAR=11.0
Pod documented
14 8 my ($code, $array) = @_;
15  
16 8 my (@keep, @extracted);
17 8 for my $orig (@$array) {
18 38 local $_ = $orig;
19 38 ▶ if ($code->()) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$code()) { } 25 13 38
20 25 push @extracted, $_;
21 }
22 else {
23 13 push @keep, $orig;
24 }
25 }
26 8 @$array = @keep;
27  
28 8 return @extracted;
29 }
30  
31 4 1;
32  
33 __END__
↑ Summary