Revision history for local::lib
+ - Put PERL5LIB first, so it'll be favored over privlibexp and
+ archlibexp when self contained.
+ - Automatically untaint @INC
+ - Prevent @INC from growing when you have multiple scripts using
+ --self-contained called from inside one another.
+
1.004001 2009-05-21
- Clean up CPAN.pm's environment variable the same way we do for
CPANPLUS. Add an example program showing local::lib employed
sub import {
my ($class, @args) = @_;
+ # Remember what PERL5LIB was when we started
+ my $perl5lib = $ENV{PERL5LIB};
+
# The path is required, but last in the list, so we pop, not shift here.
my $path = pop @args;
$path = $class->resolve_path($path);
}
if ($flag eq '--self-contained') {
# The only directories that remain are those that we just defined and those where core modules are stored.
- @INC = ($Config::Config{privlibexp}, $Config::Config{archlibexp}, split ':', $ENV{PERL5LIB});
+ # We put PERL5LIB first, so it'll be favored over privlibexp and archlibexp
+ @INC = ( $class->install_base_perl_path($path), $class->install_base_arch_path($path), split( ':', $perl5lib ), $Config::Config{privlibexp}, $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;
}
elsif (defined $flag) {
die "unrecognized import argument: $flag";
}
+ m/(.*)/ and $_ = $1 for @INC; # Untaint @INC
}
sub pipeline;