--- rat/lonuserstate.pm 2020/01/16 21:49:07 1.149.2.2.2.1 +++ rat/lonuserstate.pm 2017/09/03 18:52:23 1.153 @@ -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.149.2.2.2.1 2020/01/16 21:49:07 raeburn Exp $ +# $Id: lonuserstate.pm,v 1.153 2017/09/03 18:52:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,7 +42,7 @@ use Safe::Hole; use Opcode; use Apache::lonenc; use Fcntl qw(:flock); -use LONCAPA; +use LONCAPA qw(:DEFAULT :match); use File::Basename; @@ -255,9 +255,9 @@ sub loadmap { push(@map_ids, $resource_id); if ($hash{'src_'.$lpc.'.'.$resource_id}) { $rescount{$lpc} ++; - if (($hash{'src_'.$lpc.'.'.$resource_id}=~/\.sequence$/) || + if (($hash{'src_'.$lpc.'.'.$resource_id}=~/\.sequence$/) || ($hash{'src_'.$lpc.'.'.$resource_id}=~/\.page$/)) { - $mapcount{$lpc} ++; + $mapcount{$lpc} ++; } } unless ($codechecked) { @@ -1209,7 +1209,7 @@ sub readmap { } @cond=('true:normal'); - unless (open(LOCKFILE,">","$fn.db.lock")) { + unless (open(LOCKFILE,">$fn.db.lock")) { # # Most likely a permissions problem on the lockfile or its directory. # @@ -1227,13 +1227,8 @@ sub readmap { &unlink_tmpfiles($fn); } undef %randompick; - undef %randompickseed; - undef %randomorder; - undef %randomizationcode; undef %hiddenurl; undef %encurl; - undef %rescount; - undef %mapcount; $retfrid=''; $errtext=''; my ($untiedhash,$untiedparmhash,$tiedhash,$tiedparmhash); # More state flags. @@ -1375,13 +1370,8 @@ sub readmap { $lock=1; } undef %randompick; - undef %randompickseed; - undef %randomorder; - undef %randomizationcode; undef %hiddenurl; undef %encurl; - undef %rescount; - undef %mapcount; $errtext=''; $retfrid=''; # @@ -1532,7 +1522,7 @@ sub build_tmp_hashes { # ---------------------------------------------------- Store away initial state { my $cfh; - if (open($cfh,">","$fn.state")) { + if (open($cfh,">$fn.state")) { print $cfh join("\n",@cond); $gotstate = 1; } else { @@ -1569,7 +1559,7 @@ sub evalstate { if (-e $fn) { my @conditions=(); { - open(my $fh,"<",$fn); + open(my $fh,"<$fn"); @conditions=<$fh>; close($fh); }