blib/lib/PDL/NiceSlice/FilterUtilCall.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 78.5% 11 / 14 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 83.0% 44 / 53 CC 9 SCAR 20.0
CC
9
Cov
85%
__ANON__
9.5
import
1.0
BEGIN
1.0
CRAP 7.4
« blib/lib/PDL/Demos/Screen.pm ↑ Summary blib/lib/PDL/Slices.pm »
1 # This original Filter::Util::Call-based
2 # PDL::NiceSlice engine.
3 #
4 120 ▶use Filter::Util::Call;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 ##############################
7 # If you mess with the import filter, please also change the pdlpp importer
8 # just above this comment! They both do similar things, but one to an eval string
9 # and one to an import file.
10 # --CED 5-Nov-2007
11 #
12 sub import {
13 126 ▶ my ($class) = @_;
Subroutine import: called CC=1 SCAR=0.0
14 126 ($file,$offset) = (caller)[1,2]; # for error reporting
15 126 $offset++;
16
17 ## Parse class name into a regexp suitable for filtration
18 126 my $terminator = terminator_regexp($class);
19  
20 filter_add(
21 sub {
22 250 ▶ my ($status, $off, $end);
Subroutine __ANON__: called CC=9 SCAR=22.6
23 250 my $count = 0;
24 250 my $data = "";
25 250 ▶ while ($status = filter_read()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status = &filter_read()) 152041 248 152289
26 152041 ▶ return $status if $status < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $status < 0 0 152041 152041
27
28 152041 ▶ if (defined($terminator) && m/$terminator/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $terminator and /$terminator/) 0 152041 152041
Condition33%1/3
defined $terminator and /$terminator/
!ll&&!rl&&r
01520410
MC/DC0%0/2
defined $terminator and /$terminator/
defined $terminator /$terminator/
Truth table33%1/3
A and B
A= defined $terminatorB= /$terminator/
ABresult
0X0
100
111
29 0 $off=1;
30 0 last;
31 }
32 152041 ▶ if (m/^\s*(__END__|__DATA__)\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*(__END__|__DATA__)\s*$/) 2 152039 152041
33 2 $end=$1; $off = 1;
34 2 last;
35 }
36 152039 $data .= $_;
37 152039 $count++;
38 152039 $_ = "";
39 }
40 250 $_ = $data;
41 250 ▶ $_ = findslice $_ unless $status < 0; # the actual filter
Branch: 1 branch
BranchTrueFalseTotal
unless $status < 0 250 0 250
42 250 ▶ $_ .= "no $class;\n" if $off;
Branch: 1 branch
BranchTrueFalseTotal
if $off 2 248 250
43 250 ▶ $_ .= "$end\n" if $end;
Branch: 1 branch
BranchTrueFalseTotal
if $end 2 248 250
44 250 return $count;
45 }
46 126 );
47 }
48  
49 sub unimport {
50 1 ▶ filter_del();
Subroutine unimport: called CC=1 SCAR=0.0
51 }
52  
53 120 1;
« blib/lib/PDL/Demos/Screen.pm ↑ Summary blib/lib/PDL/Slices.pm »