line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Shipwright::Util::CleanINC; |
2
|
1
|
|
|
1
|
|
807
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
4
|
1
|
|
|
1
|
|
4
|
use Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
335
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub import { |
7
|
|
|
|
|
|
|
# It's expensive to do, but we need to find out what's in @INC now that |
8
|
|
|
|
|
|
|
# should be kept (because it was specified on the commandline with -I) |
9
|
|
|
|
|
|
|
# and what we should drop because it's baked into perl as a local lib |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
11
|
my %skip_lib_path = map { $_ => 1 } _default_inc(); |
|
5
|
|
|
|
|
20
|
|
12
|
1
|
|
50
|
|
|
11
|
my @explicit_libs = grep {!/inc$/} split( /[:;]/,($ENV{'PERL5LIB'} ||'')); |
|
3
|
|
|
|
|
12
|
|
13
|
1
|
|
50
|
|
|
8
|
my @inc_libs = grep {/inc$/} split( /[:;]/,($ENV{'PERL5LIB'} ||'')); |
|
3
|
|
|
|
|
7
|
|
14
|
|
|
|
|
|
|
# if the libs are explicitly specified, don't pull them from @INC |
15
|
1
|
|
|
|
|
4
|
my @new_base_inc = grep { !$skip_lib_path{$_}++ } ( @explicit_libs, @INC,@inc_libs); |
|
16
|
|
|
|
|
47
|
|
16
|
10
|
|
|
|
|
26
|
@INC = map { /(.+)/; $1 } grep { defined } ( |
|
10
|
|
|
|
|
83
|
|
|
12
|
|
|
|
|
167
|
|
17
|
|
|
|
|
|
|
@new_base_inc, $Config::Config{updatesarch}, |
18
|
|
|
|
|
|
|
$Config::Config{updateslib}, $Config::Config{archlibexp}, |
19
|
1
|
|
|
|
|
9
|
$Config::Config{privlibexp}, '.' |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
{ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# This code stolen from |
28
|
|
|
|
|
|
|
# http://cpansearch.perl.org/src/ANDYA/Test-Harness-3.15/lib/Test/Harness.pm |
29
|
|
|
|
|
|
|
# Cache this to avoid repeatedly shelling out to Perl. |
30
|
|
|
|
|
|
|
my @inc; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _default_inc { |
33
|
1
|
50
|
|
1
|
|
3
|
return @inc if @inc; |
34
|
1
|
|
|
|
|
7
|
local $ENV{PERL5LIB} = ''; |
35
|
1
|
|
|
|
|
8
|
local $ENV{PERLLIB} = ''; |
36
|
1
|
|
|
|
|
4
|
local $ENV{PERL5DB} = ''; |
37
|
1
|
|
|
|
|
5
|
local $ENV{PERL5OPT} = ''; |
38
|
1
|
|
|
|
|
3
|
local $ENV{PERL5ENV} = ''; |
39
|
1
|
50
|
|
|
|
10
|
local $ENV{PATH} = $1 if $ENV{PATH} =~ /^(.*)$/; |
40
|
1
|
|
|
|
|
1
|
my $perl; |
41
|
1
|
50
|
|
|
|
5
|
$perl = $1 if $^X =~ /^(.*)$/; |
42
|
|
|
|
|
|
|
# Avoid using -l for the benefit of Perl 6 |
43
|
1
|
50
|
|
|
|
5076
|
chomp( @inc = map { /^(.*)$/ && $1 } `$perl -e "print join qq[\\n], \@INC, q[]"` ); |
|
5
|
|
|
|
|
69
|
|
44
|
1
|
|
|
|
|
41
|
return @inc; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |