[Bast-commits] r6646 - in local-lib/1.000/trunk: . lib/local
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Fri Jun 12 08:22:14 GMT 2009
Author: t0m
Date: 2009-06-12 08:22:13 +0000 (Fri, 12 Jun 2009)
New Revision: 6646
Modified:
local-lib/1.000/trunk/Changes
local-lib/1.000/trunk/lib/local/lib.pm
Log:
grink's fixes for --self-contained
Modified: local-lib/1.000/trunk/Changes
===================================================================
--- local-lib/1.000/trunk/Changes 2009-06-12 07:00:02 UTC (rev 6645)
+++ local-lib/1.000/trunk/Changes 2009-06-12 08:22:13 UTC (rev 6646)
@@ -1,5 +1,11 @@
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
Modified: local-lib/1.000/trunk/lib/local/lib.pm
===================================================================
--- local-lib/1.000/trunk/lib/local/lib.pm 2009-06-12 07:00:02 UTC (rev 6645)
+++ local-lib/1.000/trunk/lib/local/lib.pm 2009-06-12 08:22:13 UTC (rev 6646)
@@ -16,6 +16,9 @@
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);
@@ -37,12 +40,17 @@
}
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;
More information about the Bast-commits
mailing list