[LON-CAPA-cvs] cvs: rat / lonuserstate.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 28 Feb 2006 20:56:41 -0000


albertel		Tue Feb 28 15:56:41 2006 EDT

  Modified files:              
    /rat	lonuserstate.pm 
  Log:
  - no free of any use of $_
  
  
  
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.105 rat/lonuserstate.pm:1.106
--- rat/lonuserstate.pm:1.105	Thu Feb 23 13:17:37 2006
+++ rat/lonuserstate.pm	Tue Feb 28 15:56:40 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construct and maintain state and binary representation of course for user
 #
-# $Id: lonuserstate.pm,v 1.105 2006/02/23 18:17:37 albertel Exp $
+# $Id: lonuserstate.pm,v 1.106 2006/02/28 20:56:40 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -93,9 +93,9 @@
     my %versions=&Apache::lonnet::dump('resourceversions',
 				       $cenv{'domain'},
 				       $cenv{'num'});
-    foreach (keys %versions) {
-	if ($_=~/^error\:/) { return; }
-	$hash{'version_'.$_}=$versions{$_};
+    foreach my $ver (keys(%versions)) {
+	if ($ver=~/^error\:/) { return; }
+	$hash{'version_'.$ver}=$versions{$ver};
     }
 }
 
@@ -379,18 +379,18 @@
 	    }
 	}
 	if (defined($hash{'to_'.$rid})) {
-	    foreach (split(/\,/,$hash{'to_'.$rid})) {
+	    foreach my $id (split(/\,/,$hash{'to_'.$rid})) {
 		my $further=$sofar;
-                if ($hash{'undercond_'.$_}) {
-		    if (defined($hash{'condid_'.$hash{'undercond_'.$_}})) {
+                if ($hash{'undercond_'.$id}) {
+		    if (defined($hash{'condid_'.$hash{'undercond_'.$id}})) {
 			$further=simplify('('.'_'.$rid.')&('.
-					  $hash{'condid_'.$hash{'undercond_'.$_}}.')');
+					  $hash{'condid_'.$hash{'undercond_'.$id}}.')');
 		    } else {
 			$errtext.='Undefined condition ID: '
-			    .$hash{'undercond_'.$_}.'. ';
+			    .$hash{'undercond_'.$id}.'. ';
 		    }
                 }
-                $newsofar=&traceroute($further,$hash{'goesto_'.$_},$beenhere,
+                $newsofar=&traceroute($further,$hash{'goesto_'.$id},$beenhere,
 				      $encflag,$hdnflag);
 	    }
 	}
@@ -486,8 +486,8 @@
         my $mpc=$hash{'map_pc_'.$hash{'src_'.$rid}};
 # ------------------------------------------- put existing resources into array
         my @currentrids=();
-        foreach (sort(keys(%hash))) {
-	    if ($_=~/^src_($mpc\.\d+)/) {
+        foreach my $key (sort(keys(%hash))) {
+	    if ($key=~/^src_($mpc\.\d+)/) {
 		if ($hash{'src_'.$1}) { push @currentrids, $1; }
             }
         }
@@ -585,15 +585,15 @@
 	    &hiddenurls();
 	}
 # ------------------------------------------------------- Put versions into src
-	foreach (keys %hash) {
-	    if ($_=~/^src\_/) {
-		$hash{$_}=&putinversion($hash{$_});
+	foreach my $key (keys(%hash)) {
+	    if ($key=~/^src\_/) {
+		$hash{$key}=&putinversion($hash{$key});
 	    }
 	}
 # ---------------------------------------------------------------- Encrypt URLs
-	foreach (keys %encurl) {
-#	    $hash{'src_'.$_}=&Apache::lonenc::encrypted($hash{'src_'.$_});
-	    $hash{'encrypted_'.$_}=1;
+	foreach my $id (keys(%encurl)) {
+#	    $hash{'src_'.$id}=&Apache::lonenc::encrypted($hash{'src_'.$id});
+	    $hash{'encrypted_'.$id}=1;
 	}
 # ----------------------------------------------- Close hashes to finally store
 # --------------------------------- Routine must pass this point, no early outs