line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
2453
|
use strict; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
285
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Path::Class::Entity; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$Path::Class::Entity::VERSION = '0.37'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
21
|
use File::Spec 3.26; |
|
7
|
|
|
|
|
126
|
|
|
7
|
|
|
|
|
106
|
|
9
|
7
|
|
|
7
|
|
2787
|
use File::stat (); |
|
7
|
|
|
|
|
38229
|
|
|
7
|
|
|
|
|
139
|
|
10
|
7
|
|
|
7
|
|
33
|
use Cwd; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
332
|
|
11
|
7
|
|
|
7
|
|
23
|
use Carp(); |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
129
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use overload |
14
|
|
|
|
|
|
|
( |
15
|
7
|
|
|
|
|
30
|
q[""] => 'stringify', |
16
|
|
|
|
|
|
|
'bool' => 'boolify', |
17
|
|
|
|
|
|
|
fallback => 1, |
18
|
7
|
|
|
7
|
|
22
|
); |
|
7
|
|
|
|
|
8
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
715
|
|
|
715
|
0
|
576
|
my $from = shift; |
22
|
|
|
|
|
|
|
my ($class, $fs_class) = (ref($from) |
23
|
|
|
|
|
|
|
? (ref $from, $from->{file_spec_class}) |
24
|
715
|
100
|
|
|
|
1192
|
: ($from, $Path::Class::Foreign)); |
25
|
715
|
|
|
|
|
1645
|
return bless {file_spec_class => $fs_class}, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
27
|
|
|
27
|
0
|
46
|
sub is_dir { 0 } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _spec_class { |
31
|
73
|
|
|
73
|
|
68
|
my ($class, $type) = @_; |
32
|
|
|
|
|
|
|
|
33
|
73
|
50
|
|
|
|
345
|
die "Invalid system type '$type'" unless ($type) = $type =~ /^(\w+)$/; # Untaint |
34
|
73
|
|
|
|
|
133
|
my $spec = "File::Spec::$type"; |
35
|
|
|
|
|
|
|
## no critic |
36
|
73
|
50
|
|
|
|
3135
|
eval "require $spec; 1" or die $@; |
37
|
73
|
|
|
|
|
237
|
return $spec; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub new_foreign { |
41
|
14
|
|
|
14
|
0
|
243
|
my ($class, $type) = (shift, shift); |
42
|
14
|
|
|
|
|
39
|
local $Path::Class::Foreign = $class->_spec_class($type); |
43
|
14
|
|
|
|
|
52
|
return $class->new(@_); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
2252
|
100
|
66
|
2252
|
|
10450
|
sub _spec { (ref($_[0]) && $_[0]->{file_spec_class}) || 'File::Spec' } |
47
|
|
|
|
|
|
|
|
48
|
14
|
|
|
14
|
0
|
100
|
sub boolify { 1 } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub is_absolute { |
51
|
|
|
|
|
|
|
# 5.6.0 has a bug with regexes and stringification that's ticked by |
52
|
|
|
|
|
|
|
# file_name_is_absolute(). Help it along with an explicit stringify(). |
53
|
120
|
|
|
120
|
0
|
366
|
$_[0]->_spec->file_name_is_absolute($_[0]->stringify) |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
24
|
|
|
24
|
0
|
38
|
sub is_relative { ! $_[0]->is_absolute } |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub cleanup { |
59
|
53
|
|
|
53
|
0
|
37
|
my $self = shift; |
60
|
53
|
|
|
|
|
60
|
my $cleaned = $self->new( $self->_spec->canonpath("$self") ); |
61
|
53
|
|
|
|
|
187
|
%$self = %$cleaned; |
62
|
53
|
|
|
|
|
118
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub resolve { |
66
|
23
|
|
|
23
|
0
|
25
|
my $self = shift; |
67
|
23
|
50
|
|
|
|
71
|
Carp::croak($! . " $self") unless -e $self; # No such file or directory |
68
|
23
|
|
|
|
|
55
|
my $cleaned = $self->new( scalar Cwd::realpath($self->stringify) ); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# realpath() always returns absolute path, kind of annoying |
71
|
23
|
100
|
|
|
|
48
|
$cleaned = $cleaned->relative if $self->is_relative; |
72
|
|
|
|
|
|
|
|
73
|
23
|
|
|
|
|
142
|
%$self = %$cleaned; |
74
|
23
|
|
|
|
|
1972
|
return $self; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub absolute { |
78
|
14
|
|
|
14
|
0
|
55
|
my $self = shift; |
79
|
14
|
100
|
|
|
|
23
|
return $self if $self->is_absolute; |
80
|
7
|
|
|
|
|
15
|
return $self->new($self->_spec->rel2abs($self->stringify, @_)); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub relative { |
84
|
13
|
|
|
13
|
0
|
33
|
my $self = shift; |
85
|
13
|
|
|
|
|
20
|
return $self->new($self->_spec->abs2rel($self->stringify, @_)); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
2
|
|
|
2
|
0
|
464
|
sub stat { File::stat::stat("$_[0]") } |
89
|
0
|
|
|
0
|
0
|
0
|
sub lstat { File::stat::lstat("$_[0]") } |
90
|
|
|
|
|
|
|
|
91
|
29
|
|
|
29
|
0
|
1475
|
sub PRUNE { return \&PRUNE; } |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
__END__ |