[LON-CAPA-cvs] cvs: loncom /interface lontest.pm

raeburn raeburn at source.lon-capa.org
Sun Dec 14 19:59:41 EST 2014


raeburn		Mon Dec 15 00:59:41 2014 EDT

  Modified files:              
    /loncom/interface	lontest.pm 
  Log:
  - Coding style:
   - keys(), sort()
   - for readability eliminate use of $_
  
  
Index: loncom/interface/lontest.pm
diff -u loncom/interface/lontest.pm:1.22 loncom/interface/lontest.pm:1.23
--- loncom/interface/lontest.pm:1.22	Mon Nov 24 17:18:01 2008
+++ loncom/interface/lontest.pm	Mon Dec 15 00:59:40 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # A debugging harness.
 #
-# $Id: lontest.pm,v 1.22 2008/11/24 17:18:01 jms Exp $
+# $Id: lontest.pm,v 1.23 2014/12/15 00:59:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -100,8 +100,8 @@
 
 	if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) {
 	    $r->print('<h2>Big Hash</h2>');
-	    foreach (sort keys %hash) {
-		$r->print("\n<br />".$_.': '.$hash{$_});
+	    foreach my $key (sort(keys(%hash))) {
+		$r->print("\n<br />".$key.': '.$hash{$key});
 	    }
 	    untie %hash;
 	} else {
@@ -111,8 +111,8 @@
 		$env{'request.course.fn'}.'_parms.db',
 		&GDBM_READER(),0640)) {
 	    $r->print('<h2>Parm Hash</h2>');
-	    foreach (sort keys %parmhash) {
-	        $r->print("\n<br />".$_.': '.$parmhash{$_});
+	    foreach my $param (sort(keys(%parmhash))) {
+	        $r->print("\n<br />".$param.': '.$parmhash{$param});
 	    }
 	    untie %parmhash;
 	} else {
@@ -120,8 +120,8 @@
 	}
 	if (tie(%symbhash,'GDBM_File',"$fn\_symb.db",&GDBM_READER(),0640)) {
             $r->print('<h2>Symb Hash</h2>');
-            foreach (sort keys %symbhash) {
-		$r->print("\n<br />".$_.': '.$symbhash{$_});
+            foreach my $symb (sort(keys(%symbhash))) {
+		$r->print("\n<br />".$symb.': '.$symbhash{$symb});
             }
             untie %symbhash;
 	} else {
@@ -134,8 +134,8 @@
 		my $fh=Apache::File->new($fn.'.state');
 		@conditions=<$fh>;
 	    }
-	    foreach (@conditions) {
-		$r->print('<tt>'.$_.'</tt><br />');
+	    foreach my $cond (@conditions) {
+		$r->print('<tt>'.$cond.'</tt><br />');
 	    }
 	}
     }




More information about the LON-CAPA-cvs mailing list