From: Olivier Mengué Date: Sun, 17 Feb 2013 22:15:38 +0000 (+0100) Subject: Do not put arch dir in $PERL5LIB (RT#67871) X-Git-Tag: 1.008008~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cdd450c566dcfefb6ee4f0cc3c6255e0c289f854;p=p5sagit%2Flocal-lib.git Do not put arch dir in $PERL5LIB (RT#67871) Since perl 5.8.1, perl automatically adds $dir/$Config{archname} for each directory in PERL5LIB, so we don't have to explicitely put those directories. Work originally partially done in May 2011. Thanks to Matt S. Trout for diagnosing a bug. --- diff --git a/lib/local/lib.pm b/lib/local/lib.pm index a97a78f..ecc4c2a 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -234,7 +234,15 @@ sub setup_local_lib_for { exit 0; } else { $class->setup_env_hash_for($path, $deactivating); - @INC = _uniq(split($Config{path_sep}, $ENV{PERL5LIB}), @INC); + my $arch_dir = $Config{archname}; + @INC = _uniq( + ( + # Inject $path/$archname for each path in PERL5LIB + map { ( File::Spec->catdir($_, $arch_dir), $_ ) } + split($Config{path_sep}, $ENV{PERL5LIB}) + ), + @INC + ); } } @@ -419,7 +427,6 @@ sub build_activate_environment_vars_for { PERL5LIB => _env_list_value( { interpolate => $interpolate, exists => 0, empty => '' }, - $class->install_base_arch_path($path), $class->install_base_perl_path($path), \'PERL5LIB', ),