From: matthewt Date: Fri, 14 Mar 2008 22:03:47 +0000 (+0000) Subject: Interpolation fixes for PERL5LIB, improve --bootstrap handling X-Git-Tag: 1.006009~92 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2447f3516d2068d5ca402cc5d82691fe9adbf96;p=p5sagit%2Flocal-lib.git Interpolation fixes for PERL5LIB, improve --bootstrap handling git-svn-id: http://dev.catalyst.perl.org/repos/bast/local-lib/1.000/trunk@4203 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/Makefile.PL b/Makefile.PL index bcfefe7..6748804 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,8 +3,10 @@ use warnings; use vars qw($bootstrapping); BEGIN { - if (grep { /^--bootstrap(?:=(.*))?$/ } @ARGV) { + if (my ($x) = grep { /^--bootstrap(?:=.*)?$/ } @ARGV) { + @ARGV = grep { !/^--bootstrap(?:=.*)?$/ } @ARGV; $bootstrapping = 1; + $x =~ /^--bootstrap(?:=(.*))?$/; my @args = (defined $1 ? ($1) : ()); $ENV{PERL_MM_USE_DEFAULT} = 1; @@ -42,7 +44,7 @@ BEGIN { $cpan_command .= 'force("install","ExtUtils::MakeMaker"); '; } if ($cpan) { - $cpan_command .= 'install("CPAN"); '; + $cpan_command .= 'force("install","CPAN"); '; } if(length $cpan_command) { system($^X, '-MCPAN', '-e', $cpan_command); diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 44db092..3fa7546 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -195,12 +195,12 @@ sub ensure_dir_structure_for { } } -sub INTERPOLATE_PATH () { 1 } -sub LITERAL_PATH () { 0 } +sub INTERPOLATE_ENV () { 1 } +sub LITERAL_ENV () { 0 } sub print_environment_vars_for { my ($class, $path) = @_; - my @envs = $class->build_environment_vars_for($path, LITERAL_PATH); + my @envs = $class->build_environment_vars_for($path, LITERAL_ENV); my $out = ''; # rather basic csh detection, goes on the assumption that something won't @@ -247,7 +247,7 @@ sub build_csh_env_declaration { sub setup_env_hash_for { my ($class, $path) = @_; - my %envs = $class->build_environment_vars_for($path, INTERPOLATE_PATH); + my %envs = $class->build_environment_vars_for($path, INTERPOLATE_ENV); @ENV{keys %envs} = values %envs; } @@ -259,10 +259,15 @@ sub build_environment_vars_for { PERL5LIB => join(':', $class->install_base_perl_path($path), $class->install_base_arch_path($path), + ($ENV{PERL5LIB} ? + ($interpolate == INTERPOLATE_ENV + ? ($ENV{PERL5LIB}) + : ('$PERL5LIB')) + : ()) ), PATH => join(':', $class->install_base_bin_path($path), - ($interpolate == INTERPOLATE_PATH + ($interpolate == INTERPOLATE_ENV ? $ENV{PATH} : '$PATH') ),