From: Olivier Mengué Date: Mon, 2 May 2011 18:30:58 +0000 (+0200) Subject: Refactor PERL_M[BM]_OPT value when --deactivate X-Git-Tag: 1.008008~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2Flocal-lib.git;a=commitdiff_plain;h=63c6dddaba59314aaf0bd5eed713318d47c6c125;hp=f878d9c10aac3774831bb1d7d7d206dc79e645d7 Refactor PERL_M[BM]_OPT value when --deactivate Simpler code for setting PERL_MB_OPT and PERL_MM_OPT when a directory is deactivated. --- diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 2e0ca1b..996cd6b 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -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;