X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Flocal%2Flib.pm;h=62ed1cf58b8adc4d1923b19e35db0e44e0db9bd8;hb=48eb676f6d8ba5368b35eb06f4d96a16b7942ec3;hp=270e660edd27abdfe7fa48850345c66e841f7a48;hpb=1bf7d892b23b26535ae99659d894d63f8cd00cb9;p=p5sagit%2Flocal-lib.git diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 270e660..62ed1cf 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -369,17 +369,17 @@ sub build_environment_vars_for { # - exists: paths are included only if they exist (default: interpolate == INTERPOLATE_ENV) # - filter: function to apply to each path do decide if it must be included # - empty: the value to return in the case of empty value -my %_env_list_value_defaults = ( +my %ENV_LIST_VALUE_DEFAULTS = ( interpolate => INTERPOLATE_ENV, exists => undef, filter => sub { 1 }, empty => undef, ); -sub _env_list_value(%@) { +sub _env_list_value { my $options = shift; die(sprintf "unknown option '$_' at %s line %u\n", (caller)[1..2]) - for grep { !exists $_env_list_value_defaults{$_} } keys %$options; - my %options = (%_env_list_value_defaults, %{ $options }); + for grep { !exists $ENV_LIST_VALUE_DEFAULTS{$_} } keys %$options; + my %options = (%ENV_LIST_VALUE_DEFAULTS, %{ $options }); $options{exists} = $options{interpolate} == INTERPOLATE_ENV unless defined $options{exists}; @@ -478,18 +478,9 @@ sub build_deactivate_environment_vars_for { # If removing ourselves from the "top of the stack", set install paths to # correspond with the new top of stack. if ($active_lls[-1] eq $path) { - if (@active_lls > 1) { - my $new_top = $active_lls[-2]; - %env = (%env, - PERL_MB_OPT => "--install_base ${new_top}", - PERL_MM_OPT => "INSTALL_BASE=${new_top}", - ); - } else { - %env = (%env, - PERL_MB_OPT => undef, - PERL_MM_OPT => undef, - ); - } + my $new_top = $active_lls[-2]; + $env{PERL_MB_OPT} = defined($new_top) ? "--install_base ${new_top}" : undef; + $env{PERL_MM_OPT} = defined($new_top) ? "INSTALL_BASE=${new_top}" : undef; } return %env;