line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
62
|
|
|
62
|
|
277572
|
use strict; |
|
62
|
|
|
|
|
132
|
|
|
62
|
|
|
|
|
1470
|
|
2
|
62
|
|
|
62
|
|
260
|
use warnings; |
|
62
|
|
|
|
|
102
|
|
|
62
|
|
|
|
|
1801
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package App::Perlbrew::Path; |
5
|
|
|
|
|
|
|
|
6
|
62
|
|
|
62
|
|
302
|
use File::Basename (); |
|
62
|
|
|
|
|
129
|
|
|
62
|
|
|
|
|
807
|
|
7
|
62
|
|
|
62
|
|
272
|
use File::Glob (); |
|
62
|
|
|
|
|
132
|
|
|
62
|
|
|
|
|
914
|
|
8
|
62
|
|
|
62
|
|
259
|
use File::Path (); |
|
62
|
|
|
|
|
106
|
|
|
62
|
|
|
|
|
2080
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use overload ( |
11
|
62
|
|
|
|
|
488
|
'""' => \& stringify, |
12
|
|
|
|
|
|
|
fallback => 1, |
13
|
62
|
|
|
62
|
|
317
|
); |
|
62
|
|
|
|
|
592
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _joinpath { |
16
|
4320
|
|
|
4320
|
|
6920
|
for my $entry (@_) { |
17
|
62
|
|
|
62
|
|
5059
|
no warnings 'uninitialized'; |
|
62
|
|
|
|
|
115
|
|
|
62
|
|
|
|
|
39791
|
|
18
|
8214
|
100
|
|
|
|
13605
|
die 'Received an undefined entry as a parameter (all parameters are: '. join(', ', @_). ')' unless (defined($entry)); |
19
|
|
|
|
|
|
|
} |
20
|
4319
|
|
|
|
|
20475
|
return join "/", @_; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _child { |
24
|
3048
|
|
|
3048
|
|
5418
|
my ($self, $package, @path) = @_; |
25
|
|
|
|
|
|
|
|
26
|
3048
|
|
|
|
|
9796
|
$package->new($self->{path}, @path); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _children { |
30
|
643
|
|
|
643
|
|
1265
|
my ($self, $package) = @_; |
31
|
|
|
|
|
|
|
|
32
|
643
|
|
|
|
|
1130
|
map { $package->new($_) } File::Glob::bsd_glob($self->child("*")); |
|
509
|
|
|
|
|
1298
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
36
|
4320
|
|
|
4320
|
0
|
431036
|
my ($class, @path) = @_; |
37
|
|
|
|
|
|
|
|
38
|
4320
|
|
|
|
|
6609
|
bless { path => _joinpath (@path) }, $class; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub exists { |
42
|
62
|
|
|
62
|
0
|
125
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
62
|
|
|
|
|
141
|
-e $self->stringify; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub basename { |
48
|
543
|
|
|
543
|
0
|
55315
|
my ($self, $suffix) = @_; |
49
|
|
|
|
|
|
|
|
50
|
543
|
|
|
|
|
2726
|
return scalar File::Basename::fileparse($self, ($suffix) x!! defined $suffix); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub child { |
54
|
2327
|
|
|
2327
|
0
|
4997
|
my ($self, @path) = @_; |
55
|
|
|
|
|
|
|
|
56
|
2327
|
|
|
|
|
4173
|
return $self->_child(__PACKAGE__, @path); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub children { |
60
|
471
|
|
|
471
|
0
|
808
|
my ($self) = @_; |
61
|
|
|
|
|
|
|
|
62
|
471
|
|
|
|
|
954
|
return $self->_children(__PACKAGE__); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub dirname { |
66
|
8
|
|
|
8
|
0
|
139
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
8
|
|
|
|
|
37
|
return App::Perlbrew::Path->new( File::Basename::dirname($self) ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub mkpath { |
72
|
206
|
|
|
206
|
0
|
913
|
my ($self) = @_; |
73
|
206
|
|
|
|
|
557
|
File::Path::mkpath( [$self->stringify], 0, 0777 ); |
74
|
206
|
|
|
|
|
1006
|
return $self; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub readlink { |
78
|
60
|
|
|
60
|
0
|
900
|
my ($self) = @_; |
79
|
|
|
|
|
|
|
|
80
|
60
|
|
|
|
|
187
|
my $link = CORE::readlink( $self->stringify ); |
81
|
60
|
100
|
|
|
|
361
|
$link = __PACKAGE__->new($link) if defined $link; |
82
|
|
|
|
|
|
|
|
83
|
60
|
|
|
|
|
395
|
return $link; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub rmpath { |
87
|
9
|
|
|
9
|
0
|
4655
|
my ($self) = @_; |
88
|
9
|
|
|
|
|
26
|
File::Path::rmtree( [$self->stringify], 0, 0 ); |
89
|
9
|
|
|
|
|
51
|
return $self; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub stringify { |
93
|
8240
|
|
|
8240
|
0
|
167951
|
my ($self) = @_; |
94
|
|
|
|
|
|
|
|
95
|
8240
|
|
|
|
|
1598804
|
return $self->{path}; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub stringify_with_tilde { |
99
|
31
|
|
|
31
|
0
|
10827
|
my ($self) = @_; |
100
|
31
|
|
|
|
|
178
|
my $path = $self->stringify; |
101
|
31
|
|
|
|
|
134
|
my $home = $ENV{HOME}; |
102
|
31
|
50
|
|
|
|
383
|
$path =~ s!\Q$home/\E!~/! if $home; |
103
|
31
|
|
|
|
|
749
|
return $path; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub symlink { |
107
|
3
|
|
|
3
|
0
|
7
|
my ($self, $destination, $force) = @_; |
108
|
3
|
50
|
|
|
|
7
|
$destination = App::Perlbrew::Path->new($destination) unless ref $destination; |
109
|
|
|
|
|
|
|
|
110
|
3
|
50
|
33
|
|
|
13
|
CORE::unlink($destination) if $force && (-e $destination || -l $destination); |
|
|
|
66
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
3
|
50
|
|
|
|
9
|
$destination if CORE::symlink($self, $destination); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub unlink { |
116
|
8
|
|
|
8
|
0
|
27
|
my ($self) = @_; |
117
|
8
|
|
|
|
|
23
|
CORE::unlink($self); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
121
|
|
|
|
|
|
|
|