lib/Perlmazing/Perlmazing/slurp.pm

filter: Statementstmt 100% 23 / 23 Branchbran 80.0% 8 / 10 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 80.8% 38 / 47 CC 8 SCAR 19.1
CC
8
Cov
87%
main
8.2
BEGIN
1.0
BEGIN
1.0
CRAP 6.7
« blib/lib/Perlmazing/Perlmazing/unix_path.pm ↑ Summary lib/Perlmazing/Perlmazing/fout.pm »
1 2 ▶use Perlmazing qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 3 ▶sub main {
Subroutine main: called CC=8 SCAR=21.0
Pod undocumented
4 3 my $file = shift;
5 3 my $binary = shift;
6 3 my $encoding;
7 {
8 2 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶ if ($binary and ($binary + 0) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($binary and $binary + 0 == 0) 1 2 3
Condition66%2/3
$binary and $binary + 0 == 0
!ll&&!rl&&r
201
MC/DC50%1/2
$binary and $binary + 0 == 0
$binary $binary + 0 == 0
Truth table66%2/3
A and B
A= $binaryB= $binary + 0 == 0
ABresult
0X0
100
111
10 1 $encoding = $binary;
11 1 undef $binary;
12 }
13 }
14 3 ▶ croak "File '$file' cannot be read: $!" unless open my $in, '<'.($encoding ? ":encoding($encoding)" : ''), $file;
Branch: 2 branches
BranchTrueFalseTotal
unless open my $in, '<' . ($encoding ? ":encoding($encoding)" : ""), $file 0 3 3
$encoding ? : 1 2 3
15 3 ▶ binmode $in if -B $file or $binary;
Branch: 1 branch
BranchTrueFalseTotal
if -B $file or $binary 0 3 3
Condition33%1/3
-B $file or $binary
l!l&&r!l&&!r
003
MC/DC0%0/2
-B $file or $binary
-B $file $binary
Truth table33%1/3
A or B
A= -B $fileB= $binary
ABresult
1X1
011
000
16 3 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 2 1 3
17 2 my @data = <$in>;
18 2 close $in;
19 2 return @data;
20 } else {
21 1 local $/ = undef;
22 1 my $data = <$in>;
23 1 close $in;
24 1 return $data;
25 }
26 }
27  
28 1;
« blib/lib/Perlmazing/Perlmazing/unix_path.pm ↑ Summary lib/Perlmazing/Perlmazing/fout.pm »