From: Andrew Rodland Date: Fri, 18 Feb 2011 04:09:47 +0000 (-0600) Subject: Put splitting PERL_LOCAL_LIB_ROOT into its own method X-Git-Tag: 1.008004~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2Flocal-lib.git;a=commitdiff_plain;h=29500601f6eec2b01ae2c8caf4b39a086263fcfa Put splitting PERL_LOCAL_LIB_ROOT into its own method we're going to be using it some more soon. --- diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 8712b9c..7881af9 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -373,10 +373,17 @@ sub build_activate_environment_vars_for { ) } +sub active_paths { + my ($class) = @_; + + return () unless defined $ENV{PERL_LOCAL_LIB_ROOT}; + return split /\Q$Config{path_sep}/, $ENV{PERL_LOCAL_LIB_ROOT}; +} + sub build_deactivate_environment_vars_for { my ($class, $path, $interpolate) = @_; - my @active_lls = split /\Q$Config{path_sep}/, $ENV{PERL_LOCAL_LIB_ROOT} || ''; + my @active_lls = $class->active_paths; if (!grep { $_ eq $path } @active_lls) { warn "Tried to deactivate inactive local::lib '$path'\n"; @@ -425,7 +432,7 @@ sub build_deactivate_environment_vars_for { sub build_deact_all_environment_vars_for { my ($class, $path, $interpolate) = @_; - my @active_lls = split /\Q$Config{path_sep}/, $ENV{PERL_LOCAL_LIB_ROOT} || ''; + my @active_lls = $class->active_paths; my @new_perl5lib = split /\Q$Config{path_sep}/, $ENV{PERL5LIB}; my @new_path = split /\Q$Config{path_sep}/, $ENV{PATH};