line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Path::Extended; |
2
|
|
|
|
|
|
|
|
3
|
27
|
|
|
27
|
|
676056
|
use strict; |
|
27
|
|
|
|
|
69
|
|
|
27
|
|
|
|
|
1001
|
|
4
|
27
|
|
|
27
|
|
144
|
use warnings; |
|
27
|
|
|
|
|
47
|
|
|
27
|
|
|
|
|
725
|
|
5
|
27
|
|
|
27
|
|
22631
|
use Sub::Install; |
|
27
|
|
|
|
|
60619
|
|
|
27
|
|
|
|
|
192
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.22'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
10
|
28
|
|
|
28
|
|
299
|
my ($class, @imports) = @_; |
11
|
|
|
|
|
|
|
|
12
|
28
|
|
|
|
|
78
|
my $caller = caller; |
13
|
|
|
|
|
|
|
|
14
|
28
|
|
|
|
|
79
|
my $file_class = $class.'::File'; |
15
|
28
|
|
|
|
|
74
|
my $dir_class = $class.'::Dir'; |
16
|
28
|
50
|
|
|
|
1749
|
eval "require $file_class" or die $@; |
17
|
28
|
50
|
|
|
|
1982
|
eval "require $dir_class" or die $@; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my %map = ( |
20
|
81
|
|
|
81
|
|
530517
|
file => sub { $file_class->new(@_) }, |
21
|
87
|
|
|
87
|
|
1258480
|
dir => sub { $dir_class->new(@_) }, |
22
|
|
|
|
|
|
|
file_or_dir => sub { |
23
|
6
|
|
|
6
|
|
4622
|
my @args = @_; |
24
|
6
|
|
|
|
|
41
|
my $file = $file_class->new(@args); |
25
|
6
|
100
|
|
|
|
39
|
return $dir_class->new(@args) if -d $file->absolute; |
26
|
4
|
|
|
|
|
22
|
return $file; |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
dir_or_file => sub { |
29
|
6
|
|
|
6
|
|
3403
|
my @args = @_; |
30
|
6
|
|
|
|
|
37
|
my $dir = $dir_class->new(@args); |
31
|
6
|
100
|
|
|
|
43
|
return $file_class->new(@args) if -f $dir->absolute; |
32
|
4
|
|
|
|
|
16
|
return $dir; |
33
|
|
|
|
|
|
|
}, |
34
|
28
|
|
|
|
|
743
|
); |
35
|
|
|
|
|
|
|
|
36
|
28
|
50
|
|
|
|
232
|
@imports = qw( file dir file_or_dir dir_or_file ) unless @imports; |
37
|
28
|
|
|
|
|
597
|
foreach my $name (@imports) { |
38
|
112
|
50
|
|
|
|
3574
|
next unless $map{$name}; |
39
|
|
|
|
|
|
|
|
40
|
112
|
|
|
|
|
618
|
Sub::Install::reinstall_sub({ |
41
|
|
|
|
|
|
|
as => $name, |
42
|
|
|
|
|
|
|
into => $caller, |
43
|
|
|
|
|
|
|
code => $map{$name}, |
44
|
|
|
|
|
|
|
}); |
45
|
112
|
|
|
|
|
6043
|
Sub::Install::reinstall_sub({ |
46
|
|
|
|
|
|
|
as => $name, |
47
|
|
|
|
|
|
|
into => $class, |
48
|
|
|
|
|
|
|
code => $map{$name}, |
49
|
|
|
|
|
|
|
}); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |