line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package exact::lib; |
2
|
|
|
|
|
|
|
# ABSTRACT: Compile-time @INC manipulation extension for exact |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
282542
|
use 5.014; |
|
1
|
|
|
|
|
13
|
|
5
|
1
|
|
|
1
|
|
6
|
use exact; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
6
|
1
|
|
|
1
|
|
1233
|
use FindBin; |
|
1
|
|
|
|
|
1077
|
|
|
1
|
|
|
|
|
700
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.04'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import { |
11
|
1
|
|
|
1
|
|
24
|
my ( $self, $params ) = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
50
|
|
|
5
|
$params //= 'lib'; |
14
|
1
|
|
|
|
|
14
|
$params =~ s/(^\s+|\s+$)//g; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
6
|
for my $dir ( map { s/\\ / /g; $_ } split( /(?
|
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
7
|
|
17
|
3
|
100
|
|
|
|
11
|
if ( index( $dir, '/', 0 ) == 0 ) { |
|
|
100
|
|
|
|
|
|
18
|
1
|
|
|
|
|
3
|
_add_to_inc($dir); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
elsif ( index( $dir, '.', 0 ) == 0 ) { |
21
|
1
|
|
|
|
|
6
|
_add_to_inc( $FindBin::Bin . '/' . $dir ); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else { |
24
|
1
|
|
|
|
|
5
|
my $found_dir = _find_dir($dir); |
25
|
1
|
50
|
|
|
|
5
|
_add_to_inc($found_dir) if ($found_dir); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _add_to_inc { |
31
|
2
|
|
|
2
|
|
4
|
for my $lib (@_) { |
32
|
2
|
50
|
|
|
|
4
|
unshift( @INC, $lib ) unless ( grep { $_ eq $lib } @INC ); |
|
23
|
|
|
|
|
43
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _find_dir { |
37
|
1
|
|
|
1
|
|
2
|
my ($suffix) = @_; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
8
|
my @search_path = split( '/', $FindBin::Bin ); |
40
|
1
|
|
|
|
|
6
|
while ( @search_path > 0 ) { |
41
|
6
|
|
|
|
|
16
|
my $dir = join( '/', @search_path, $suffix ); |
42
|
6
|
50
|
|
|
|
219
|
return $dir if ( -d $dir ); |
43
|
6
|
|
|
|
|
26
|
pop @search_path; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
3
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |