[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 15 Sep 2006 07:14:05 -0000


albertel		Fri Sep 15 03:14:05 2006 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - BUG#4977, appenv was doing alot of unneeded unesacpe and reescape which was slowing problem parsing down by about .5 second per problem
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.778 loncom/lonnet/perl/lonnet.pm:1.779
--- loncom/lonnet/perl/lonnet.pm:1.778	Tue Sep  5 16:42:15 2006
+++ loncom/lonnet/perl/lonnet.pm	Fri Sep 15 03:14:04 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.778 2006/09/05 20:42:15 albertel Exp $
+# $Id: lonnet.pm,v 1.779 2006/09/15 07:14:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -344,6 +344,11 @@
             $env{$key}=$newenv{$key};
         }
     }
+    foreach my $key (keys(%newenv)) {
+	my $value = &escape($newenv{$key});
+	delete($newenv{$key});
+	$newenv{&escape($key)}=$value;
+    }
 
     my $lockfh;
     unless (open($lockfh,"$env{'user.environment'}")) {
@@ -369,8 +374,6 @@
         chomp($oldenv[$i]);
         if ($oldenv[$i] ne '') {
 	    my ($name,$value)=split(/=/,$oldenv[$i],2);
-	    $name=&unescape($name);
-	    $value=&unescape($value);
 	    unless (defined($newenv{$name})) {
 		$newenv{$name}=$value;
 	    }
@@ -383,7 +386,7 @@
 	}
 	my $newname;
 	foreach $newname (keys %newenv) {
-	    print $fh &escape($newname).'='.&escape($newenv{$newname})."\n";
+	    print $fh $newname.'='.$newenv{$newname}."\n";
 	}
 	close($fh);
     }