From: t0m Date: Mon, 15 Jun 2009 23:51:01 +0000 (+0000) Subject: Slightly cleanup @INC vs PERL5LIB handling in --self-contained, and fix duplicate... X-Git-Tag: 1.006009~71 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2Flocal-lib.git;a=commitdiff_plain;h=69b801068fe0db14eda9fabf2683d2644b2e1224;hp=53699c992388febac03ba5b9b967e935bebafd17 Slightly cleanup @INC vs PERL5LIB handling in --self-contained, and fix duplicate code from merge git-svn-id: http://dev.catalyst.perl.org/repos/bast/local-lib/1.000/trunk@6687 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/Changes b/Changes index 786b2fa..602cc93 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,12 @@ Revision history for local::lib + - Set PERL5LIB back to calculated @INC with --self-contained, to stop + invoking other perl scripts from losing the local::lib if they + mangle @INC from $ENV{PERL5LIB} (t0m) + 1.004002 2009-06-15 - - Fixed up INC untaint procedure to skip/ignore CODE, ARRAY, blessed entries. + - Fixed up INC untaint procedure to skip/ignore CODE, ARRAY, + blessed entries. (grink) - Include test in xt/ for the above - Put PERL5LIB first, so it'll be favored over privlibexp and diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 1054bdc..9440ad3 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -41,8 +41,8 @@ DEATH if ($flag eq '--self-contained') { # The only directories that remain are those that we just defined and those where core modules are stored. # We put PERL5LIB first, so it'll be favored over privlibexp and archlibexp - @INC = ($Config::Config{privlibexp}, $Config::Config{archlibexp}, split $Config{path_sep}, $ENV{PERL5LIB}); - @INC = ( + my %seen; + @INC = grep { ! $seen{$_}++ } ( $class->install_base_perl_path($path), $class->install_base_arch_path($path), split( $Config{path_sep}, $perl5lib ), @@ -50,8 +50,9 @@ DEATH $Config::Config{archlibexp} ); - # We explicitly set PERL5LIB here (back to what it was originally) to prevent @INC from growing with each invocation - $ENV{PERL5LIB} = $perl5lib; + # We explicitly set PERL5LIB here to the above de-duped list to prevent + # @INC from growing with each invocation + $ENV{PERL5LIB} = join( $Config{path_sep}, @INC ); } elsif (defined $flag) { die "unrecognized import argument: $flag";