[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lon-capa-cvs
Subject:    [LON-CAPA-cvs] cvs: loncom / lond
From:       matthew <lon-capa-cvs () mail ! lon-capa ! org>
Date:       2002-09-30 21:38:18
Message-ID: cvsmatthew1033421898 () cvsserver
[Download RAW message or body]

matthew		Mon Sep 30 17:38:18 2002 EDT

  Modified files:              
    /loncom	lond 
  Log:
  Rewritten to speed up 'dump' calls with no regular expression.
  Use while ... each instead of foreach.
  Do not unescape anything or use eval if the regular expression is '.'.
  Use chop instead of a regular expression to remove trailing '&'.
  One enhancement that might speed up the statistics page is removing the
  call to 'eval'.
  
  
Index: loncom/lond
diff -u loncom/lond:1.99 loncom/lond:1.100
--- loncom/lond:1.99	Thu Sep 19 22:04:07 2002
+++ loncom/lond	Mon Sep 30 17:38:18 2002
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.99 2002/09/20 02:04:07 foxr Exp $
+# $Id: lond,v 1.100 2002/09/30 21:38:18 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1224,21 +1224,25 @@
 		       } else {
                           $regexp='.';
 		       }
-                       my $proname=propath($udom,$uname);
                        my $qresult='';
-      if (tie(%hash,'GDBM_File',"$proname/$namespace.db",&GDBM_READER,0640)) {
+                       my $proname=propath($udom,$uname);
+    if (tie(%hash,'GDBM_File',"$proname/$namespace.db",&GDBM_READER(),0640)) {
                            study($regexp);
-                           foreach $key (keys %hash) {
-                               my $unescapeKey = &unescape($key);
-                               if (eval('$unescapeKey=~/$regexp/')) {
-                                  $qresult.="$key=$hash{$key}&";
-                              }
+                           while (($key,$value) = each(%hash)) {
+                               if ($regexp eq '.') {
+                                   $qresult.=$key.'='.$value.'&';
+                               } else {
+                                   my $unescapeKey = &unescape($key);
+                                   if (eval('$unescapeKey=~/$regexp/')) {
+                                       $qresult.="$key=$value&";
+                                   }
+                               }
                            }
-			   if (untie(%hash)) {
-		              $qresult=~s/\&$//;
-                              print $client "$qresult\n";
+                           if (untie(%hash)) {
+                               chop($qresult);
+                               print $client "$qresult\n";
                            } else {
-                              print $client "error:$!\n";
+                               print $client "error:$!\n";
                            }
                        } else {
                            print $client "error:$!\n";



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic