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
|
|
219123
|
use 5.014; |
|
1
|
|
|
|
|
12
|
|
5
|
1
|
|
|
1
|
|
4
|
use exact; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
553
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
7
|
1
|
|
|
1
|
|
392
|
use FindBin; |
|
1
|
|
|
|
|
886
|
|
|
1
|
|
|
|
|
539
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '1.03'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
12
|
1
|
|
|
1
|
|
10
|
my ( $self, $caller, $input ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
50
|
|
|
4
|
$input //= 'lib'; |
15
|
1
|
|
|
|
|
10
|
$input =~ s/(^\s+|\s+$)//g; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
5
|
for my $dir ( map { s/\\ / /g; $_ } split( /(?
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
5
|
|
18
|
3
|
100
|
|
|
|
10
|
if ( index( $dir, '/', 0 ) == 0 ) { |
|
|
100
|
|
|
|
|
|
19
|
1
|
|
|
|
|
2
|
_add_to_inc($dir); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
elsif ( index( $dir, '.', 0 ) == 0 ) { |
22
|
1
|
|
|
|
|
3
|
_add_to_inc( $FindBin::Bin . '/' . $dir ); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
else { |
25
|
1
|
|
|
|
|
2
|
my $found_dir = _find_dir($dir); |
26
|
1
|
50
|
|
|
|
3
|
_add_to_inc($found_dir) if ($found_dir); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _add_to_inc { |
32
|
2
|
|
|
2
|
|
5
|
for my $lib (@_) { |
33
|
2
|
50
|
|
|
|
3
|
unshift( @INC, $lib ) unless ( grep { $_ eq $lib } @INC ); |
|
23
|
|
|
|
|
33
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _find_dir { |
38
|
1
|
|
|
1
|
|
2
|
my ($suffix) = @_; |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
6
|
my @search_path = split( '/', $FindBin::Bin ); |
41
|
1
|
|
|
|
|
4
|
while ( @search_path > 0 ) { |
42
|
6
|
|
|
|
|
11
|
my $dir = join( '/', @search_path, $suffix ); |
43
|
6
|
50
|
|
|
|
184
|
return $dir if ( -d $dir ); |
44
|
6
|
|
|
|
|
19
|
pop @search_path; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
4
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |