line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
63
|
|
|
63
|
|
334308
|
use strict; |
|
63
|
|
|
|
|
170
|
|
|
63
|
|
|
|
|
1825
|
|
2
|
63
|
|
|
63
|
|
345
|
use warnings; |
|
63
|
|
|
|
|
131
|
|
|
63
|
|
|
|
|
2292
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package App::Perlbrew::Path; |
5
|
|
|
|
|
|
|
|
6
|
63
|
|
|
63
|
|
354
|
use File::Basename (); |
|
63
|
|
|
|
|
145
|
|
|
63
|
|
|
|
|
962
|
|
7
|
63
|
|
|
63
|
|
325
|
use File::Glob (); |
|
63
|
|
|
|
|
162
|
|
|
63
|
|
|
|
|
1086
|
|
8
|
63
|
|
|
63
|
|
335
|
use File::Path (); |
|
63
|
|
|
|
|
149
|
|
|
63
|
|
|
|
|
2630
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use overload ( |
11
|
63
|
|
|
|
|
485
|
'""' => \& stringify, |
12
|
|
|
|
|
|
|
fallback => 1, |
13
|
63
|
|
|
63
|
|
1021
|
); |
|
63
|
|
|
|
|
178
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _joinpath { |
16
|
4324
|
|
|
4324
|
|
8543
|
for my $entry (@_) { |
17
|
63
|
|
|
63
|
|
5950
|
no warnings 'uninitialized'; |
|
63
|
|
|
|
|
193
|
|
|
63
|
|
|
|
|
49776
|
|
18
|
8220
|
100
|
|
|
|
17079
|
die 'Received an undefined entry as a parameter (all parameters are: '. join(', ', @_). ')' unless (defined($entry)); |
19
|
|
|
|
|
|
|
} |
20
|
4323
|
|
|
|
|
26723
|
return join "/", @_; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _child { |
24
|
3048
|
|
|
3048
|
|
6840
|
my ($self, $package, @path) = @_; |
25
|
|
|
|
|
|
|
|
26
|
3048
|
|
|
|
|
12216
|
$package->new($self->{path}, @path); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _children { |
30
|
643
|
|
|
643
|
|
1356
|
my ($self, $package) = @_; |
31
|
|
|
|
|
|
|
|
32
|
643
|
|
|
|
|
1382
|
map { $package->new($_) } File::Glob::bsd_glob($self->child("*")); |
|
509
|
|
|
|
|
1731
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
36
|
4324
|
|
|
4324
|
0
|
521857
|
my ($class, @path) = @_; |
37
|
|
|
|
|
|
|
|
38
|
4324
|
|
|
|
|
8194
|
bless { path => _joinpath (@path) }, $class; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub exists { |
42
|
62
|
|
|
62
|
0
|
182
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
62
|
|
|
|
|
189
|
-e $self->stringify; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub basename { |
48
|
543
|
|
|
543
|
0
|
74285
|
my ($self, $suffix) = @_; |
49
|
|
|
|
|
|
|
|
50
|
543
|
|
|
|
|
3243
|
return scalar File::Basename::fileparse($self, ($suffix) x!! defined $suffix); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub child { |
54
|
2327
|
|
|
2327
|
0
|
6520
|
my ($self, @path) = @_; |
55
|
|
|
|
|
|
|
|
56
|
2327
|
|
|
|
|
5279
|
return $self->_child(__PACKAGE__, @path); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub children { |
60
|
471
|
|
|
471
|
0
|
1127
|
my ($self) = @_; |
61
|
|
|
|
|
|
|
|
62
|
471
|
|
|
|
|
1098
|
return $self->_children(__PACKAGE__); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub dirname { |
66
|
8
|
|
|
8
|
0
|
171
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
8
|
|
|
|
|
42
|
return App::Perlbrew::Path->new( File::Basename::dirname($self) ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub mkpath { |
72
|
206
|
|
|
206
|
0
|
1294
|
my ($self) = @_; |
73
|
206
|
|
|
|
|
785
|
File::Path::mkpath( [$self->stringify], 0, 0777 ); |
74
|
206
|
|
|
|
|
1227
|
return $self; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub readlink { |
78
|
61
|
|
|
61
|
0
|
1212
|
my ($self) = @_; |
79
|
|
|
|
|
|
|
|
80
|
61
|
|
|
|
|
197
|
my $link = CORE::readlink( $self->stringify ); |
81
|
61
|
100
|
|
|
|
423
|
$link = __PACKAGE__->new($link) if defined $link; |
82
|
|
|
|
|
|
|
|
83
|
61
|
|
|
|
|
459
|
return $link; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub rmpath { |
87
|
9
|
|
|
9
|
0
|
5426
|
my ($self) = @_; |
88
|
9
|
|
|
|
|
43
|
File::Path::rmtree( [$self->stringify], 0, 0 ); |
89
|
9
|
|
|
|
|
54
|
return $self; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub stringify { |
93
|
8242
|
|
|
8242
|
0
|
216022
|
my ($self) = @_; |
94
|
|
|
|
|
|
|
|
95
|
8242
|
|
|
|
|
2210470
|
return $self->{path}; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub stringify_with_tilde { |
99
|
31
|
|
|
31
|
0
|
13694
|
my ($self) = @_; |
100
|
31
|
|
|
|
|
129
|
my $path = $self->stringify; |
101
|
31
|
|
|
|
|
119
|
my $home = $ENV{HOME}; |
102
|
31
|
50
|
|
|
|
423
|
$path =~ s!\Q$home/\E!~/! if $home; |
103
|
31
|
|
|
|
|
354
|
return $path; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub symlink { |
107
|
3
|
|
|
3
|
0
|
6
|
my ($self, $destination, $force) = @_; |
108
|
3
|
50
|
|
|
|
10
|
$destination = App::Perlbrew::Path->new($destination) unless ref $destination; |
109
|
|
|
|
|
|
|
|
110
|
3
|
50
|
33
|
|
|
9
|
CORE::unlink($destination) if $force && (-e $destination || -l $destination); |
|
|
|
66
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
3
|
50
|
|
|
|
11
|
$destination if CORE::symlink($self, $destination); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub unlink { |
116
|
8
|
|
|
8
|
0
|
44
|
my ($self) = @_; |
117
|
8
|
|
|
|
|
26
|
CORE::unlink($self); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
121
|
|
|
|
|
|
|
|