« 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
Condition100%3/3
@rest == 0 and builtin::blessed($thing)
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)
| |||||||||||||||||||||||||||||
| 21 | 1831 | ▶ | return $thing if $thing->isa(__PACKAGE__); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1017 | ▶ | return bless(Path::Tiny::path("$thing"), __PACKAGE__) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$thing->isa("Path::Class::Entity") or $thing->isa("Path::Tiny")
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")
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||