| 1 | package Shipwright::Util::CleanINC; | ||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 3 | ▶ | use Config; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 3 | ▶ | sub import { | ||||||||||||||||||
|
Subroutine
import: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 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 | 3 | my %skip_lib_path = map { $_ => 1 } _default_inc(); | |||||||||||||||||||
| 12 | 3 | ▶ | my @explicit_libs = grep {!/inc$/} split( /[:;]/,($ENV{'PERL5LIB'} ||'')); | ||||||||||||||||||
|
Condition50%1/2
$ENV{'PERL5LIB'} || ''
MC/DC0%0/1
$ENV{'PERL5LIB'} || ''
$ENV{'PERL5LIB'}
Truth table50%1/2
A
A= $ENV{'PERL5LIB'}
| |||||||||||||||||||||
| 13 | 3 | ▶ | my @inc_libs = grep {/inc$/} split( /[:;]/,($ENV{'PERL5LIB'} ||'')); | ||||||||||||||||||
|
Condition50%1/2
$ENV{'PERL5LIB'} || ''
MC/DC0%0/1
$ENV{'PERL5LIB'} || ''
$ENV{'PERL5LIB'}
Truth table50%1/2
A
A= $ENV{'PERL5LIB'}
| |||||||||||||||||||||
| 14 | # if the libs are explicitly specified, don't pull them from @INC | ||||||||||||||||||||
| 15 | 3 | my @new_base_inc = grep { !$skip_lib_path{$_}++ } ( @explicit_libs, @INC,@inc_libs); | |||||||||||||||||||
| 16 | 22 | @INC = map { /(.+)/; $1 } grep { defined } ( | |||||||||||||||||||
| 17 | @new_base_inc, $Config::Config{updatesarch}, | ||||||||||||||||||||
| 18 | $Config::Config{updateslib}, $Config::Config{archlibexp}, | ||||||||||||||||||||
| 19 | 3 | $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 | 3 | my @inc; | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 3 | ▶ | sub _default_inc { | ||||||||||||||||||
|
Subroutine
_default_inc: called CC=5 SCAR=16.7
| |||||||||||||||||||||
| 33 | 3 | ▶ | return @inc if @inc; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 34 | 3 | local $ENV{PERL5LIB} = ''; | |||||||||||||||||||
| 35 | 3 | local $ENV{PERLLIB} = ''; | |||||||||||||||||||
| 36 | 3 | local $ENV{PERL5DB} = ''; | |||||||||||||||||||
| 37 | 3 | local $ENV{PERL5OPT} = ''; | |||||||||||||||||||
| 38 | 3 | local $ENV{PERL5ENV} = ''; | |||||||||||||||||||
| 39 | 3 | ▶ | local $ENV{PATH} = $1 if $ENV{PATH} =~ /^(.*)$/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | 3 | my $perl; | |||||||||||||||||||
| 41 | 3 | ▶ | $perl = $1 if $^X =~ /^(.*)$/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 42 | # Avoid using -l for the benefit of Perl 6 | ||||||||||||||||||||
| 43 | 3 | ▶ | chomp( @inc = map { /^(.*)$/ && $1 } `$perl -e "print join qq[\\n], \@INC, q[]"` ); | ||||||||||||||||||
|
Condition33%1/3
/^(.*)$/ && $1
MC/DC0%0/2
/^(.*)$/ && $1
/^(.*)$/
$1
Truth table33%1/3
A && B
A= /^(.*)$/B= $1
| |||||||||||||||||||||
| 44 | 3 | return @inc; | |||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 3 | 1; | |||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | __END__ | ||||||||||||||||||||