Path.pm

filter: Statementstmt 75.0% 24 / 32 Branchbran 16.6% 2 / 12 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 64.8% 35 / 54 CC 8 SCAR 26.9
CC
8
Cov
61%
new
23.3
BEGIN
1.0
BEGIN
1.0
CRAP 14.7
« Path/Role/Path.pm ↑ Summary Path/File/Win32.pm »
1 package Parse::Path;
2  
3 7 our $VERSION = '0.92'; # VERSION
4 # ABSTRACT: Parser for paths
5  
6 #############################################################################
7 # Modules
8  
9 7 ▶use sanity;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 7 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 7 ▶use Module::Runtime qw( use_module );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 7 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 7 ▶no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 #############################################################################
18 # Dispatcher
19  
20 80 ▶sub new {
Subroutine new: called CC=8 SCAR=31.5
Pod undocumented
21 80 my $class = shift;
22 80 my %opts;
23  
24 80 ▶ if (@_ == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) { } 0 80 80
25 # XXX: Many of these forms are purposely undocumented and experimental
26 0 my $arg = pop;
27 0 ▶ if (blessed $arg) {
Branch: 3 branches
BranchTrueFalseTotal
if (builtin::blessed($arg)) { } 0 0 0
elsif (ref $arg eq 'ARRAY') { } 0 0 0
elsif (ref $arg eq 'HASH') { } 0 0 0
28 0 ▶ if ($arg->does('Parse::Path::Role::Path')) { return $arg->clone; }
Branch: 1 branch
BranchTrueFalseTotal
if ($arg->does('Parse::Path::Role::Path')) { } 0 0 0
29 0 else { $opts{path} = "$arg"; }
30 }
31 0 elsif (ref $arg eq 'ARRAY') { %opts = @$arg; }
32 0 elsif (ref $arg eq 'HASH') { %opts = %$arg; }
33 0 else { $opts{path} = $arg; }
34 }
35 # NOTE: if @_ == 0, it gets passed to DZIL and fails with its own path attr error
36 80 else { %opts = @_; }
37  
38 80 ▶ my $style = delete $opts{style} // 'DZIL';
Condition100%2/2
delete $opts{"style"} // "DZIL"
l!l
6119
MC/DC100%1/1
delete $opts{"style"} // "DZIL"
delete $opts{"style"}
Truth table100%2/2
A
A= delete $opts{"style"}
Aresult
11
00
39 80 ▶ $style = "Parse::Path::$style" unless ($style =~ s/^\=//); # NOTE: kill two birds with one stone
Branch: 1 branch
BranchTrueFalseTotal
unless $style =~ s/^\=// 80 0 80
40  
41 # Load+create the path
42 80 return use_module($style)->new(%opts);
43 }
44  
45 7 42;
46  
47 __END__
« Path/Role/Path.pm ↑ Summary Path/File/Win32.pm »