[Bast-commits] r3739 - local-lib/1.000/trunk/lib/local

apeiron at dev.catalyst.perl.org apeiron at dev.catalyst.perl.org
Fri Sep 14 02:16:22 GMT 2007


Author: apeiron
Date: 2007-09-14 02:16:22 +0100 (Fri, 14 Sep 2007)
New Revision: 3739

Modified:
   local-lib/1.000/trunk/lib/local/lib.pm
Log:
Move the shell detection code *out* of the while loop. 
apeiron-- /kick apeiron idiot


Modified: local-lib/1.000/trunk/lib/local/lib.pm
===================================================================
--- local-lib/1.000/trunk/lib/local/lib.pm	2007-09-14 00:12:00 UTC (rev 3738)
+++ local-lib/1.000/trunk/lib/local/lib.pm	2007-09-14 01:16:22 UTC (rev 3739)
@@ -188,20 +188,20 @@
   my ($class, $path) = @_;
   my @envs = $class->build_environment_vars_for($path, LITERAL_PATH);
   my $out = '';
+  # rather basic csh detection, goes on the assumption that something won't
+  # call itself csh unless it really is. also, default to bourne in the
+  # pathological situation where a user doesn't have $ENV{SHELL} defined.
+  # note also that shells with funny names, like zoid, are assumed to be
+  # bourne.
+  my $shellbin = 'sh';
+  if(defined $ENV{'SHELL'}) {
+      my @shell_bin_path_parts = File::Spec->splitpath($ENV{'SHELL'});
+      $shellbin = $shell_bin_path_parts[-1];
+  }
   while (@envs) {
     my ($name, $value) = (shift(@envs), shift(@envs));
     $value =~ s/(\\")/\\$1/g;
 
-    # rather basic csh detection, goes on the assumption that something won't
-    # call itself csh unless it really is. also, default to bourne in the
-    # pathological situation where a user doesn't have $ENV{SHELL} defined.
-    # note also that shells with funny names, like zoid, are assumed to be
-    # bourne.
-    my $shellbin = 'sh';
-    if(defined $ENV{'SHELL'}) {
-      my @shell_bin_path_parts = File::Spec->splitpath($ENV{'SHELL'});
-      $shellbin = $shell_bin_path_parts[-1];
-    }
     if($shellbin =~ /csh/) {
       $out .= qq{setenv ${name} "${value}"\n};
     }




More information about the Bast-commits mailing list