IO/All/File.pm

filter: Statementstmt 93.1% 27 / 29 Branchbran 100% 4 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 5 totaltotal 80.0% 40 / 50 CC 4 SCAR 6.4
CC
4
Cov
92%
can_upgrade
3.0
file
2.0
print
2.0
CRAP 1.9
« IO/All.pm ↑ Summary IO/All/Filesys.pm »
1 package IO::All::File;
2 3 ▶use IO::All::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 extends 'IO::All::Filesys';
4  
5 3 option 'utf8';
6  
7 3 has handle => ();
8  
9 # Upgrade from IO::All to IO::All::Dir
10 3 ▶use constant upgrade_methods => [qw(file print)];
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 4 ▶sub can_upgrade {
Subroutine can_upgrade: called CC=3 SCAR=11.0
Pod undocumented
13 4 my ($self, $object) = @_;
14 4 my $location = $object->location;
15 return if
16 4 ▶ not defined $location or
Branch: 1 branch
BranchTrueFalseTotal
unless defined $location and length $location 1 3 4
Condition66%2/3
defined $location and length $location
!ll&&!rl&&r
103
MC/DC50%1/2
defined $location and length $location
defined $location length $location
Truth table66%2/3
A and B
A= defined $locationB= length $location
ABresult
0X0
100
111
17 not length $location;
18 3 -f $location;
19 }
20  
21 #
22 # Worker Methods:
23 #
24  
25 2 ▶sub file {
Subroutine file: called CC=2 SCAR=6.9
Pod undocumented
26 2 my $self = shift;
27 2 ▶ $self->name(shift) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 1 1 2
28 2 return $self;
29 }
30  
31 3 ▶sub open {
Subroutine open: called CC=1 SCAR=0.0
Pod undocumented
32 3 my $self = shift;
33 3 my $fh;
34 3 open $fh, '<', $self->name;
35 3 $self->handle($fh);
36 3 return $self;
37 }
38  
39 3 ▶sub all {
Subroutine all: called CC=1 SCAR=0.0
Pod undocumented
40 3 my $self = shift;
41 3 my $fh = $self->open->handle;
42 3 return do { local $/; <$fh> }
43 }
44  
45 0 ▶sub print {
Subroutine print: not called CC=1 SCAR=6.9
Pod undocumented
46 0 my $self = shift;
47 0 CORE::print(@_);
48 }
49  
50 3 1;
« IO/All.pm ↑ Summary IO/All/Filesys.pm »