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

foxr foxr@source.lon-capa.org
Tue, 11 Jan 2011 10:51:48 -0000


foxr		Tue Jan 11 10:51:48 2011 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Add check for error return in dump() prior to trying to build the hash.
  Probably should have even more robust error detection/recovery in some 
  conspiracy between lonnet.pm and its clients.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1097 loncom/lonnet/perl/lonnet.pm:1.1098
--- loncom/lonnet/perl/lonnet.pm:1.1097	Sat Jan  8 06:13:20 2011
+++ loncom/lonnet/perl/lonnet.pm	Tue Jan 11 10:51:48 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1097 2011/01/08 06:13:20 raeburn Exp $
+# $Id: lonnet.pm,v 1.1098 2011/01/11 10:51:48 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4438,15 +4438,18 @@
     my $rep=&reply("dump:$udomain:$uname:$namespace:$regexp:$range:$extra",$uhome);
     my @pairs=split(/\&/,$rep);
     my %returnhash=();
-    foreach my $item (@pairs) {
-	my ($key,$value)=split(/=/,$item,2);
-	$key = &unescape($key);
-	next if ($key =~ /^error: 2 /);
-	$returnhash{$key}=&thaw_unescape($value);
+    if (!($rep =~ /^error/ )) {
+	foreach my $item (@pairs) {
+	    my ($key,$value)=split(/=/,$item,2);
+	    $key = &unescape($key);
+	    next if ($key =~ /^error: 2 /);
+	    $returnhash{$key}=&thaw_unescape($value);
+	}
     }
     return %returnhash;
 }
 
+
 # --------------------------------------------------------- dumpstore interface
 
 sub dumpstore {