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