From: David Golden Date: Tue, 4 Jan 2011 12:45:59 +0000 (-0500) Subject: Refactor print_environment_vars_for() X-Git-Tag: 1.008004~24 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8cc924b824f86c1c12361cbe4b21e72412fe8509;p=p5sagit%2Flocal-lib.git Refactor print_environment_vars_for() Splits it into environment_vars_string_for() to generate the string and leaves print_environment_vars_for() as just a print wrapper around it. --- diff --git a/lib/local/lib.pm b/lib/local/lib.pm index ee0bbd3..caa778c 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -267,6 +267,11 @@ sub guess_shelltype { sub print_environment_vars_for { my ($class, $path) = @_; + print $class->environment_vars_string_for($path); +} + +sub environment_vars_string_for { + my ($class, $path) = @_; my @envs = $class->build_environment_vars_for($path, LITERAL_ENV); my $out = ''; @@ -283,7 +288,7 @@ sub print_environment_vars_for { $value =~ s/(\\")/\\$1/g; $out .= $class->${\"build_${shelltype}_env_declaration"}($name, $value); } - print $out; + return $out; } # simple routines that take two arguments: an %ENV key and a value. return