| 1 | package Path::Abstract::Underload; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 5 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | $Path::Abstract::Underload::VERSION = '0.096'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: Path::Abstract without stringification overloading | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use Sub::Exporter -setup => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | exports => [ path => sub { sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | return __PACKAGE__->new(@_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | } } ], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 5 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use Scalar::Util qw/blessed/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 5 | require Path::Abstract::Fast; # For now... | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 554 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 554 | my $path = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 554 | my $self = bless \$path, shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 554 | $self->set(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 554 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 49 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 49 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 49 | my $path = $$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 49 | return bless \$path, ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 786 | ▶ | sub _canonize(@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_canonize: called CC=14 SCAR=26.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 5 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | @_ = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1125 | ▶ | $_ = ref && (ref eq "Path::Abstract::Underload" || blessed $_ && $_->isa("Path::Abstract::Underload")) ? $$_ : $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
ref $_ and ref $_ eq "Path::Abstract::Underload" || builtin::blessed($_) && $_->isa("Path::Abstract::Underload")
ref $_ eq "Path::Abstract::Underload" or builtin::blessed($_) and $_->isa("Path::Abstract::Underload")
builtin::blessed($_) and $_->isa("Path::Abstract::Underload")
MC/DC50%2/4
ref $_ and ref $_ eq "Path::Abstract::Underload" || builtin::blessed($_) && $_->isa("Path::Abstract::Underload")
ref $_
ref $_ eq "Path::Abstract::Underload"
builtin::blessed($_)
$_->isa("Path::Abstract::Underload")
Truth table60%3/5
A and B or C and D
A= ref $_B= ref $_ eq "Path::Abstract::Underload"C= builtin::blessed($_)D= $_->isa("Path::Abstract::Underload")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1125 | ▶ | length() ? $_ : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 786 | ▶ | ref eq "ARRAY" ? @$_ : $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 786 | ▶ | my $leading = $_[0] && substr($_[0], 0, 1) eq '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$_[0] && substr($_[0], 0, 1) eq '/'
MC/DC100%2/2
$_[0] && substr($_[0], 0, 1) eq '/'
$_[0]
substr($_[0], 0, 1) eq '/'
Truth table100%3/3
A && B
A= $_[0]B= substr($_[0], 0, 1) eq '/'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 786 | my $path = join '/', @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 786 | ▶ | my $trailing = $path && substr($path, -1) eq '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$path && substr($path, -1) eq '/'
MC/DC100%2/2
$path && substr($path, -1) eq '/'
$path
substr($path, -1) eq '/'
Truth table100%3/3
A && B
A= $pathB= substr($path, -1) eq '/'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # From File::Spec::Unix::canonpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 786 | $path =~ s|/{2,}|/|g; # xx////xx -> xx/xx | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 786 | $path =~ s{(?:/\.)+(?:/|\z)}{/}g; # xx/././xx -> xx/xx | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 786 | ▶ | $path =~ s|^(?:\./)+||s unless $path eq "./"; # ./xx -> xx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 786 | $path =~ s|^/(?:\.\./)+|/|; # /../../xx -> xx | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 786 | $path =~ s|^/\.\.$|/|; # /.. -> / | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 786 | ▶ | $path =~ s|/\z|| unless $path eq "/"; # xx/ -> xx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 786 | ▶ | $path .= '/' if $path ne "/" && $trailing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$path ne "/" and $trailing
MC/DC100%2/2
$path ne "/" and $trailing
$path ne "/"
$trailing
Truth table100%3/3
A and B
A= $path ne "/"B= $trailing
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 786 | ▶ | $path =~ s/^\/+// unless $leading; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 786 | return $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 713 | ▶ | sub set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 713 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 713 | $$self = _canonize @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 713 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 525 | ▶ | sub is_empty { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_empty: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 525 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 525 | return $$self eq ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 5 | ▶ | for (qw(is_nil)) { no strict 'refs'; *$_ = \&is_empty } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 45 | ▶ | sub is_root { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_root: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 45 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 45 | return $$self eq "/"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 30 | ▶ | sub is_tree { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_tree: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 30 | return substr($$self, 0, 1) eq "/"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 19 | ▶ | sub is_branch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_branch: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 19 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 19 | ▶ | Path::Abstract->_0_093_warn if $Path::Abstract::_0_093_warn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # return $$self && substr($$self, 0, 1) ne "/"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 19 | ▶ | return ! $$self || substr($$self, 0, 1) ne "/"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
!$$self || substr($$self, 0, 1) ne '/'
MC/DC100%2/2
!$$self || substr($$self, 0, 1) ne '/'
!$$self
substr($$self, 0, 1) ne '/'
Truth table100%3/3
not(A) || B
A= !$$selfB= substr($$self, 0, 1) ne '/'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 11 | ▶ | sub to_tree { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_tree: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 11 | ▶ | $$self = "/$$self" unless $self->is_tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 11 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 11 | ▶ | sub to_branch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_branch: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 11 | $$self =~ s/^\///; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 11 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 23 | ▶ | sub list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 23 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 23 | ▶ | Path::Abstract->_0_093_warn if $Path::Abstract::_0_093_warn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 23 | return grep { length $_ } split m/\//, $$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | for (qw()) { no strict 'refs'; *$_ = \&list } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 4 | ▶ | sub split { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 4 | ▶ | Path::Abstract->_0_093_warn if $Path::Abstract::_0_093_warn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 4 | my @split = split m/(?<=.)\/(?=.)/, $$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 4 | return @split; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 19 | ▶ | sub first { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
first: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 19 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 19 | ▶ | Path::Abstract->_0_093_warn if $Path::Abstract::_0_093_warn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 19 | return $self->at(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 22 | ▶ | sub last { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
last: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 22 | ▶ | Path::Abstract->_0_093_warn if $Path::Abstract::_0_093_warn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 22 | return $self->at(-1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 65 | ▶ | sub at { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
at: called CC=13 SCAR=25.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 65 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 65 | ▶ | return '' if $self->is_empty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 54 | my @path = split '/', $$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 54 | ▶ | return '' if 1 == @path && '' eq $path[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
1 == @path and "" eq $path[0]
MC/DC0%0/2
1 == @path and "" eq $path[0]
1 == @path
"" eq $path[0]
Truth table66%2/3
A and B
A= 1 == @pathB= "" eq $path[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 54 | my $index = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 54 | ▶ | if (0 > $index) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 25 | $index += @path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ▶ | elsif (! defined $path[0] || ! length $path[0]) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
defined $path[0] && length $path[0]
MC/DC100%2/2
defined $path[0] && length $path[0]
defined $path[0]
length $path[0]
Truth table100%3/3
A && B
A= defined $path[0]B= length $path[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 19 | $index += 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 54 | ▶ | return '' if $index >= @path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 48 | ▶ | $index -= 1 if $index == @path - 1 && ! defined $path[$index] || ! length $path[$index]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$index == @path - 1 and not defined $path[$index] or not length $path[$index]
$index == @path - 1 and not defined $path[$index]
MC/DC66%2/3
$index == @path - 1 and not defined $path[$index] or not length $path[$index]
$index == @path - 1
not defined $path[$index]
not length $path[$index]
Truth table60%3/5
A and not(B) or not(C)
A= $index == @path - 1B= not defined $path[$index]C= not length $path[$index]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 48 | ▶ | return '' unless defined $path[$index] && length $path[$index]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $path[$index] and length $path[$index]
MC/DC50%1/2
defined $path[$index] and length $path[$index]
defined $path[$index]
length $path[$index]
Truth table66%2/3
A and B
A= defined $path[$index]B= length $path[$index]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 45 | return $path[$index]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 8 | ▶ | sub beginning { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
beginning: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 8 | my ($beginning) = $$self =~ m{^(\/?[^/]*)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 8 | return $beginning; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 38 | ▶ | sub ending { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ending: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 38 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 38 | my ($ending) = $$self =~ m{([^/]*\/?)$}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 38 | return $ending; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 501 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 501 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 501 | return $$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 5 | ▶ | for (qw(path stringify)) { no strict 'refs'; *$_ = \&get } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 73 | ▶ | sub push { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
push: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 73 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 73 | $$self = _canonize $$self, @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 73 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 5 | ▶ | for (qw(down)) { no strict 'refs'; *$_ = \&push } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 15 | ▶ | sub child { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
child: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 15 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 15 | my $child = $self->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 15 | return $child->push(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 10 | ▶ | sub append { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 10 | ▶ | return $self unless @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 10 | $self->set($$self . join '/', @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 30 | ▶ | sub extension { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extension: called CC=18 SCAR=29.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 30 | my $extension; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 30 | ▶ | if (@_ && ! defined $_[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
@_ and not defined $_[0]
MC/DC0%0/2
@_ and not defined $_[0]
@_
not defined $_[0]
Truth table66%2/3
A and not(B)
A= @_B= not defined $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $extension = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | elsif (ref $_[0] eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 26 | $extension = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 30 | my $options; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 30 | ▶ | if (ref $_[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 5 | $options = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 25 | $options = { match => shift }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 30 | ▶ | my $matcher = $options->{match} || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$options->{'match'} || 1
MC/DC100%1/1
$options->{'match'} || 1
$options->{'match'}
Truth table100%2/2
A
A= $options->{'match'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 30 | ▶ | if ('*' eq $matcher) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | $matcher = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 30 | ▶ | if (ref $matcher eq 'Regexp') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | ▶ | elsif ($matcher eq '' || $matcher =~ m/^\d+$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$matcher eq "" or $matcher =~ /^\d+$/
MC/DC0%0/2
$matcher eq "" or $matcher =~ /^\d+$/
$matcher eq ""
$matcher =~ /^\d+$/
Truth table66%2/3
A or B
A= $matcher eq ""B= $matcher =~ /^\d+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 30 | $matcher = qr/((?:\.[^\.]+){1,$matcher})$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $matcher = qr/$matcher/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 30 | my $ending = $self->ending; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 30 | ▶ | if (! defined $extension) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 10 | ▶ | return '' if $self->is_empty || $self->is_root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->is_empty or $self->is_root
MC/DC100%2/2
$self->is_empty or $self->is_root
$self->is_empty
$self->is_root
Truth table100%3/3
A or B
A= $self->is_emptyB= $self->is_root
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 8 | return join '', $ending =~ $matcher; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 20 | ▶ | if ('' eq $extension) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | elsif ($extension !~ m/^\./) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 3 | $extension = '.' . $extension; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 20 | ▶ | if ($self->is_empty || $self->is_root) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->is_empty or $self->is_root
MC/DC100%2/2
$self->is_empty or $self->is_root
$self->is_empty
$self->is_root
Truth table100%3/3
A or B
A= $self->is_emptyB= $self->is_root
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 6 | $self->append($extension); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 14 | ▶ | if ($ending =~ s/$matcher/$extension/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 13 | $self->pop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 13 | $self->push($ending); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 1 | $self->append($extension); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 20 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 5 | my %pop_re = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | '' => qr{(/)?([^/]+)(/)?$}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | '$' => qr{(/)?([^/]+/?)()$}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 190 | ▶ | sub _pop { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pop: called CC=13 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 190 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 190 | ▶ | return '' if $self->is_empty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 190 | my $count = shift @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 190 | ▶ | $count = 1 unless defined $count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 190 | my ($greedy_lead, $re); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 190 | ▶ | if ($count =~ s/([\^\$\*])$//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 84 | ▶ | $greedy_lead = 1 if $1 ne '$'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 84 | ▶ | $re = $pop_re{'$'} if $1 ne '^'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 190 | ▶ | $re = $pop_re{''} unless $re; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 190 | ▶ | $count = 1 unless length $count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 190 | my @popped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 5 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 190 | ▶ | while ($count--) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 273 | ▶ | if ($$self =~ s/$re//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 262 | my $popped = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 262 | ▶ | unshift(@popped, $popped) if $popped; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 262 | ▶ | if (! length $$self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 86 | ▶ | if ($greedy_lead) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 32 | substr $popped[0], 0, 0, $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 54 | $$self .= $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 86 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 11 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 190 | return \@popped; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | #my %pop_re = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | # '' => qr{(.)?([^/]+)/?$}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | # '+' => qr{(.)?([^/]+)/?$}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | # '*' => qr{(.)?([^/]+/?)$}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | #); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | #sub _pop { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # return '' if $self->is_empty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # my $count = shift @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # $count = 1 unless defined $count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # my ($greed, $greed_plus, $greed_star); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | # if ($count =~ s/([+*])$//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # $greed = $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | # if ($greed eq '+') { $greed_plus = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # else { $greed_star = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | # else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # $greed = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # my $re = $pop_re{$greed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # $count = 1 unless length $count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # my @popped; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # while ($count--) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | # if ($$self =~ s/$re//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # my $popped = $2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # unshift(@popped, $popped) if $popped; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # if ($1 && $1 eq '/' && ! length $$self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # if ($greed) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # substr $popped[0], 0, 0, $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # $$self = $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | # elsif (! $$self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # return \@popped; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 150 | ▶ | sub pop { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pop: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 150 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 150 | ▶ | return (ref $self)->new('') if $self->is_empty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 137 | my $popped = $self->_pop(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 137 | return (ref $self)->new(join '/', @$popped); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 69 | ▶ | sub up { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
up: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 69 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 69 | ▶ | return $self if $self->is_empty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 53 | $self->_pop(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 53 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | #sub up { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | # my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # return $self if $self->is_empty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # my $count = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # $count = shift @_ if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | # while (! $self->is_empty && $count--) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | # if ($$self =~ s/(^|^\/|\/)([^\/]+)$//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | # if ($1 && ! length $$self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # $$self = $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # elsif (! $$self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | # return $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 11 | ▶ | sub parent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parent: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 11 | my $parent = $self->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 11 | return $parent->up(1, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 5 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 5 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 5 | eval { require Path::Class }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 5 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | *dir = *file = sub { croak "Path::Class is not available" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 5 | ▶ | *file = sub { return Path::Class::file(shift->get, @_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 5 | ▶ | *dir = sub { return Path::Class::dir(shift->get, @_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 5 | 1; # End of Path::Abstract::Underload | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||