--- rat/lonuserstate.pm 2006/02/23 18:17:37 1.105 +++ rat/lonuserstate.pm 2006/02/28 20:56:40 1.106 @@ -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 @@ sub processversionfile { 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 @@ sub traceroute { } } 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 @@ sub hiddenurls { 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 @@ sub readmap { &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