| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
720
|
use v5.10; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
103
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package lib::vendor; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: add vendor libraries to the module search path (@INC) |
|
5
|
|
|
|
|
|
|
our $VERSION = '0.14.163'; # VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
44
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
826
|
use FindBin (); |
|
|
1
|
|
|
|
|
1125
|
|
|
|
1
|
|
|
|
|
19
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use File::Spec (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
106
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# File layout could be: |
|
13
|
|
|
|
|
|
|
# . |
|
14
|
|
|
|
|
|
|
# +- bin |
|
15
|
|
|
|
|
|
|
# +- lib |
|
16
|
|
|
|
|
|
|
# +- vendor |
|
17
|
|
|
|
|
|
|
# +- ... |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
# Or: |
|
20
|
|
|
|
|
|
|
# |
|
21
|
|
|
|
|
|
|
# . |
|
22
|
|
|
|
|
|
|
# +- lib |
|
23
|
|
|
|
|
|
|
# +- vendor |
|
24
|
|
|
|
|
|
|
# +- ... |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $APPDIR; |
|
27
|
|
|
|
|
|
|
BEGIN { |
|
28
|
1
|
50
|
|
1
|
|
5
|
if ( not $APPDIR ) { |
|
29
|
1
|
|
|
|
|
1
|
$APPDIR = $FindBin::RealBin; |
|
30
|
1
|
|
33
|
|
|
330
|
while ( $APPDIR ne '/' && !-d File::Spec->catdir( $APPDIR, 'lib' ) ) { |
|
31
|
|
|
|
|
|
|
# Search upwards in the directory structure |
|
32
|
|
|
|
|
|
|
# until we find a subdirectory named 'lib'. |
|
33
|
0
|
|
|
|
|
0
|
my @appdir = File::Spec->splitdir($APPDIR); |
|
34
|
0
|
|
|
|
|
0
|
pop @appdir; |
|
35
|
0
|
|
|
|
|
0
|
$APPDIR = File::Spec->catdir(@appdir); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
our $VENDOR //= 'vendor'; |
|
41
|
|
|
|
|
|
|
sub import { |
|
42
|
3
|
|
|
3
|
|
7
|
my ( $package, @vendors ) = @_; |
|
43
|
|
|
|
|
|
|
|
|
44
|
3
|
100
|
|
|
|
9
|
if ( @vendors ) { |
|
45
|
2
|
100
|
66
|
|
|
13
|
if ( defined $vendors[0] && $vendors[0] eq '-vendor' ) { |
|
46
|
1
|
|
|
|
|
4
|
( undef, my $vendor, @vendors ) = @vendors; |
|
47
|
1
|
50
|
|
|
|
3
|
$VENDOR = $vendor if defined $vendor; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
2
|
|
|
|
|
4
|
for my $vendor (@vendors) { |
|
51
|
2
|
|
|
|
|
19
|
$vendor = File::Spec->catdir( $APPDIR, $VENDOR, $vendor, 'lib' ); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
} |
|
54
|
3
|
|
|
|
|
19
|
unshift @vendors, File::Spec->catdir( $APPDIR, "lib" ); |
|
55
|
|
|
|
|
|
|
|
|
56
|
3
|
|
|
|
|
9
|
shrink_INC(@vendors); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub shrink_INC { |
|
60
|
4
|
|
|
4
|
0
|
5
|
local $_; |
|
61
|
4
|
|
|
|
|
7
|
my %seen = (); |
|
62
|
57
|
|
|
|
|
54
|
@INC = grep { |
|
63
|
4
|
|
|
|
|
9
|
my $key; |
|
64
|
57
|
50
|
33
|
|
|
1597
|
if ( ref($_) ) { |
|
|
|
50
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# If it's a ref, key on the memory address. |
|
66
|
0
|
|
|
|
|
0
|
$key = int $_; |
|
67
|
|
|
|
|
|
|
} elsif ( $^O ne 'MSWin32' and my ($dev, $inode) = stat($_) ) { |
|
68
|
|
|
|
|
|
|
# If it's on the filesystem, key on the combo of dev and inode, |
|
69
|
|
|
|
|
|
|
# which is not valid on MSWin32. |
|
70
|
57
|
|
|
|
|
119
|
$key = join( _ => $dev, $inode ); |
|
71
|
|
|
|
|
|
|
} else { |
|
72
|
|
|
|
|
|
|
# Otherwise, key on the element. |
|
73
|
0
|
|
|
|
|
0
|
$key = $_; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
57
|
50
|
|
|
|
381
|
$key && !$seen{$key}++; |
|
76
|
|
|
|
|
|
|
} @_, @INC; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |