line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
62
|
|
|
62
|
|
346860
|
use strict; |
|
62
|
|
|
|
|
174
|
|
|
62
|
|
|
|
|
1891
|
|
2
|
62
|
|
|
62
|
|
671
|
use warnings; |
|
62
|
|
|
|
|
158
|
|
|
62
|
|
|
|
|
2078
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package App::Perlbrew::Path; |
5
|
|
|
|
|
|
|
|
6
|
62
|
|
|
62
|
|
335
|
use File::Basename (); |
|
62
|
|
|
|
|
131
|
|
|
62
|
|
|
|
|
900
|
|
7
|
62
|
|
|
62
|
|
299
|
use File::Glob (); |
|
62
|
|
|
|
|
108
|
|
|
62
|
|
|
|
|
1089
|
|
8
|
62
|
|
|
62
|
|
329
|
use File::Path (); |
|
62
|
|
|
|
|
155
|
|
|
62
|
|
|
|
|
2650
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use overload ( |
11
|
62
|
|
|
|
|
500
|
'""' => \& stringify, |
12
|
|
|
|
|
|
|
fallback => 1, |
13
|
62
|
|
|
62
|
|
1004
|
); |
|
62
|
|
|
|
|
171
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _joinpath { |
16
|
4434
|
|
|
4434
|
|
8530
|
for my $entry (@_) { |
17
|
62
|
|
|
62
|
|
6201
|
no warnings 'uninitialized'; |
|
62
|
|
|
|
|
178
|
|
|
62
|
|
|
|
|
49805
|
|
18
|
8421
|
100
|
|
|
|
17287
|
die 'Received an undefined entry as a parameter (all parameters are: '. join(', ', @_). ')' unless (defined($entry)); |
19
|
|
|
|
|
|
|
} |
20
|
4433
|
|
|
|
|
26321
|
return join "/", @_; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _child { |
24
|
3135
|
|
|
3135
|
|
7052
|
my ($self, $package, @path) = @_; |
25
|
|
|
|
|
|
|
|
26
|
3135
|
|
|
|
|
11794
|
$package->new($self->{path}, @path); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _children { |
30
|
656
|
|
|
656
|
|
1329
|
my ($self, $package) = @_; |
31
|
|
|
|
|
|
|
|
32
|
656
|
|
|
|
|
1424
|
map { $package->new($_) } File::Glob::bsd_glob($self->child("*")); |
|
515
|
|
|
|
|
1627
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
36
|
4434
|
|
|
4434
|
0
|
547267
|
my ($class, @path) = @_; |
37
|
|
|
|
|
|
|
|
38
|
4434
|
|
|
|
|
8364
|
bless { path => _joinpath (@path) }, $class; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub exists { |
42
|
63
|
|
|
63
|
0
|
160
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
63
|
|
|
|
|
177
|
-e $self->stringify; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub basename { |
48
|
549
|
|
|
549
|
0
|
75598
|
my ($self, $suffix) = @_; |
49
|
|
|
|
|
|
|
|
50
|
549
|
|
|
|
|
3343
|
return scalar File::Basename::fileparse($self, ($suffix) x!! defined $suffix); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub child { |
54
|
2381
|
|
|
2381
|
0
|
6429
|
my ($self, @path) = @_; |
55
|
|
|
|
|
|
|
|
56
|
2381
|
|
|
|
|
5336
|
return $self->_child(__PACKAGE__, @path); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub children { |
60
|
477
|
|
|
477
|
0
|
1156
|
my ($self) = @_; |
61
|
|
|
|
|
|
|
|
62
|
477
|
|
|
|
|
1057
|
return $self->_children(__PACKAGE__); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub dirname { |
66
|
8
|
|
|
8
|
0
|
180
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
8
|
|
|
|
|
54
|
return App::Perlbrew::Path->new( File::Basename::dirname($self) ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub mkpath { |
72
|
211
|
|
|
211
|
0
|
1199
|
my ($self) = @_; |
73
|
211
|
|
|
|
|
754
|
File::Path::mkpath( [$self->stringify], 0, 0777 ); |
74
|
211
|
|
|
|
|
1294
|
return $self; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub readlink { |
78
|
60
|
|
|
60
|
0
|
1124
|
my ($self) = @_; |
79
|
|
|
|
|
|
|
|
80
|
60
|
|
|
|
|
195
|
my $link = CORE::readlink( $self->stringify ); |
81
|
60
|
100
|
|
|
|
448
|
$link = __PACKAGE__->new($link) if defined $link; |
82
|
|
|
|
|
|
|
|
83
|
60
|
|
|
|
|
581
|
return $link; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub rmpath { |
87
|
9
|
|
|
9
|
0
|
5519
|
my ($self) = @_; |
88
|
9
|
|
|
|
|
31
|
File::Path::rmtree( [$self->stringify], 0, 0 ); |
89
|
9
|
|
|
|
|
58
|
return $self; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub stringify { |
93
|
8440
|
|
|
8440
|
0
|
220017
|
my ($self) = @_; |
94
|
|
|
|
|
|
|
|
95
|
8440
|
|
|
|
|
2202765
|
return $self->{path}; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub stringify_with_tilde { |
99
|
31
|
|
|
31
|
0
|
14420
|
my ($self) = @_; |
100
|
31
|
|
|
|
|
139
|
my $path = $self->stringify; |
101
|
31
|
|
|
|
|
120
|
my $home = $ENV{HOME}; |
102
|
31
|
50
|
|
|
|
447
|
$path =~ s!\Q$home/\E!~/! if $home; |
103
|
31
|
|
|
|
|
880
|
return $path; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub symlink { |
107
|
3
|
|
|
3
|
0
|
10
|
my ($self, $destination, $force) = @_; |
108
|
3
|
50
|
|
|
|
8
|
$destination = App::Perlbrew::Path->new($destination) unless ref $destination; |
109
|
|
|
|
|
|
|
|
110
|
3
|
50
|
33
|
|
|
11
|
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
|
32
|
my ($self) = @_; |
117
|
8
|
|
|
|
|
30
|
CORE::unlink($self); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
121
|
|
|
|
|
|
|
|