line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::ShareDir::Dist; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
58316
|
use strict; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
46
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
38
|
|
5
|
2
|
|
|
2
|
|
31
|
use 5.008001; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
12
|
use base qw( Exporter ); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
213
|
|
7
|
2
|
|
|
2
|
|
18
|
use File::Spec; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
907
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw( dist_share ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: Locate per-dist shared files |
12
|
|
|
|
|
|
|
our $VERSION = '0.06'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# TODO: Works with PAR |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our %over; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub dist_share ($) |
20
|
|
|
|
|
|
|
{ |
21
|
10
|
|
|
10
|
1
|
29236
|
my($dist_name) = @_; |
22
|
|
|
|
|
|
|
|
23
|
10
|
|
|
|
|
23
|
$dist_name =~ s/::/-/g; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
local $over{$1} = $2 |
26
|
10
|
100
|
66
|
|
|
40
|
if defined $ENV{PERL_FILE_SHAREDIR_DIST} && $ENV{PERL_FILE_SHAREDIR_DIST} =~ /^(.*?)=(.*)$/; |
27
|
|
|
|
|
|
|
|
28
|
10
|
100
|
|
|
|
72
|
return File::Spec->rel2abs($over{$dist_name}) if $over{$dist_name}; |
29
|
|
|
|
|
|
|
|
30
|
7
|
|
|
|
|
19
|
my @pm = split /-/, $dist_name; |
31
|
7
|
|
|
|
|
14
|
$pm[-1] .= ".pm"; |
32
|
|
|
|
|
|
|
|
33
|
7
|
|
|
|
|
13
|
foreach my $inc (@INC) |
34
|
|
|
|
|
|
|
{ |
35
|
8
|
|
|
|
|
57
|
my $pm = File::Spec->catfile( $inc, @pm ); |
36
|
8
|
100
|
|
|
|
184
|
if(-f $pm) |
37
|
|
|
|
|
|
|
{ |
38
|
5
|
|
|
|
|
32
|
my $share = File::Spec->catdir( $inc, qw( auto share dist ), $dist_name ); |
39
|
5
|
100
|
|
|
|
113
|
if(-d $share) |
40
|
|
|
|
|
|
|
{ |
41
|
3
|
|
|
|
|
37
|
return File::Spec->rel2abs($share); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
2
|
50
|
|
|
|
17
|
if(!File::Spec->file_name_is_absolute($inc)) |
45
|
|
|
|
|
|
|
{ |
46
|
2
|
|
|
|
|
45
|
my($v,$dir) = File::Spec->splitpath( File::Spec->rel2abs($inc), 1 ); |
47
|
2
|
|
|
|
|
15
|
my @dirs = File::Spec->splitdir($dir); |
48
|
2
|
50
|
33
|
|
|
13
|
if(defined $dirs[-1] && $dirs[-1] eq 'lib') |
49
|
|
|
|
|
|
|
{ |
50
|
2
|
|
|
|
|
3
|
pop @dirs; # pop off the 'lib'; |
51
|
|
|
|
|
|
|
# put humpty dumpty back together again |
52
|
2
|
|
|
|
|
25
|
my $share = File::Spec->catdir( |
53
|
|
|
|
|
|
|
File::Spec->catpath($v, |
54
|
|
|
|
|
|
|
File::Spec->catdir(@dirs), |
55
|
|
|
|
|
|
|
'', |
56
|
|
|
|
|
|
|
), |
57
|
|
|
|
|
|
|
'share', |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
2
|
100
|
|
|
|
43
|
if(-d $share) |
61
|
|
|
|
|
|
|
{ |
62
|
1
|
|
|
|
|
7
|
return $share; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
2
|
last; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
3
|
|
|
|
|
15
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub import |
75
|
|
|
|
|
|
|
{ |
76
|
2
|
|
|
2
|
|
3423
|
my($class, @args) = @_; |
77
|
|
|
|
|
|
|
|
78
|
2
|
|
|
|
|
3
|
my @modify; |
79
|
|
|
|
|
|
|
|
80
|
2
|
|
|
|
|
6
|
foreach my $arg (@args) |
81
|
|
|
|
|
|
|
{ |
82
|
2
|
100
|
|
|
|
10
|
if($arg =~ /^-(.*?)=(.*)$/) |
83
|
|
|
|
|
|
|
{ |
84
|
1
|
|
|
|
|
5
|
$over{$1} = $2; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
else |
87
|
|
|
|
|
|
|
{ |
88
|
1
|
|
|
|
|
3
|
push @modify, $arg; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
|
|
5
|
@_ = ($class, @modify); |
93
|
|
|
|
|
|
|
|
94
|
2
|
|
|
|
|
2378
|
goto \&Exporter::import; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |