blib/lib/Dist/Zilla/Path.pm

filter: Statementstmt 69.4% 25 / 36 Branchbran 75.0% 6 / 8 Conditioncond 83.3% 5 / 6 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 77.7% 7 / 9 Podpod 33.3% 1 / 3 totaltotal 71.2% 47 / 66 CC 7 SCAR 13.2
CC
7
Cov
72%
path
6.0
file
6.0
subdir
2.0
CRAP 3.7
« blib/lib/Dist/Zilla/Plugin/CPANFile.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm »
1 package Dist::Zilla::Path 6.040;
2 # ABSTRACT: a helper to get Path::Tiny objects
3  
4 53 ▶use Dist::Zilla::Pragmas;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 53 ▶use parent 'Path::Tiny';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 53 ▶use Path::Tiny 0.052 qw(); # issue 427
Subroutine BEGIN: called CC=1 SCAR=0.0
9 53 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 53 ▶use Sub::Exporter -setup => {
Subroutine BEGIN: called CC=1 SCAR=0.0
11 exports => [ qw( path ) ],
12 groups => { default => [ qw( path ) ] },
13 53 };
14  
15 53 ▶use namespace::autoclean -except => 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 4129 ▶sub path {
Subroutine path: called CC=6 SCAR=17.9
Pod documented
18 4129 my ($thing, @rest) = @_;
19  
20 4129 ▶ if (@rest == 0 && blessed $thing) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rest == 0 and builtin::blessed($thing)) 1831 2298 4129
Condition100%3/3
@rest == 0 and builtin::blessed($thing)
!ll&&!rl&&r
222961831
MC/DC100%2/2
@rest == 0 and builtin::blessed($thing)
@rest == 0 builtin::blessed($thing)
Truth table100%3/3
A and B
A= @rest == 0B= builtin::blessed($thing)
ABresult
0X0
100
111
21 1831 ▶ return $thing if $thing->isa(__PACKAGE__);
Branch: 1 branch
BranchTrueFalseTotal
if $thing->isa(__PACKAGE__) 814 1017 1831
22  
23 1017 ▶ return bless(Path::Tiny::path("$thing"), __PACKAGE__)
Branch: 1 branch
BranchTrueFalseTotal
if $thing->isa("Path::Class::Entity") or $thing->isa("Path::Tiny") 839 178 1017
Condition66%2/3
$thing->isa("Path::Class::Entity") or $thing->isa("Path::Tiny")
l!l&&r!l&&!r
0839178
MC/DC50%1/2
$thing->isa("Path::Class::Entity") or $thing->isa("Path::Tiny")
$thing->isa("Path::Class::Entity") $thing->isa("Path::Tiny")
Truth table66%2/3
A or B
A= $thing->isa("Path::Class::Entity")B= $thing->isa("Path::Tiny")
ABresult
1X1
011
000
24 if $thing->isa('Path::Class::Entity') || $thing->isa('Path::Tiny');
25 }
26  
27 2476 return bless(Path::Tiny::path($thing, @rest), __PACKAGE__);
28 }
29  
30 53 my %warned;
31  
32 0 ▶sub file {
Subroutine file: not called CC=2 SCAR=17.9
Pod undocumented
33 0 my ($self, @file) = @_;
34  
35 0 my ($package, $pmfile, $line) = caller;
36  
37 0 my $key = join qq{\0}, $pmfile, $line;
38 0 ▶ unless ($warned{ $key }++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($warned{$key}++) 0 0 0
39 0 Carp::carp("->file called on a Dist::Zilla::Path object; this will cease to work in Dist::Zilla v7; downstream code should be updated to use Path::Tiny API, not Path::Class");
40 }
41  
42 0 require Path::Class;
43 0 Path::Class::dir($self)->file(@file);
44 }
45  
46 0 ▶sub subdir {
Subroutine subdir: not called CC=1 SCAR=6.9
Pod undocumented
47 0 my ($self, @subdir) = @_;
48 0 Carp::carp("->subdir called on a Dist::Zilla::Path object; this will cease to work in Dist::Zilla v7; downstream code should be updated to use Path::Tiny API, not Path::Class");
49 0 require Path::Class;
50 0 Path::Class::dir($self)->subdir(@subdir);
51 }
52  
53 53 1;
54  
55 __END__
« blib/lib/Dist/Zilla/Plugin/CPANFile.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm »