[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
www
lon-capa-cvs@mail.lon-capa.org
Thu, 27 Jun 2002 21:11:44 -0000
www Thu Jun 27 17:11:44 2002 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
Possible endless loop if an ambiguous resource is part of a randompick
sequence (meaning, one is trying to randomly choose between the same resources).
This will now not work at all.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.248 loncom/lonnet/perl/lonnet.pm:1.249
--- loncom/lonnet/perl/lonnet.pm:1.248 Thu Jun 27 15:04:15 2002
+++ loncom/lonnet/perl/lonnet.pm Thu Jun 27 17:11:44 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.248 2002/06/27 19:04:15 www Exp $
+# $Id: lonnet.pm,v 1.249 2002/06/27 21:11:44 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1741,7 +1741,7 @@
if ($thisallowed=~/X/) {
if ($ENV{'acc.randomout'}) {
- my $symb=&symbread($uri);
+ my $symb=&symbread($uri,1);
if (($symb) && ($ENV{'acc.randomout'}=~/\&$symb\&/)) {
return '';
}
@@ -2701,7 +2701,7 @@
# ------------------------------------------------------ Return symb list entry
sub symbread {
- my $thisfn=shift;
+ my ($thisfn,$donotrecurse)=@_;
# no filename provided? try from environment
unless ($thisfn) {
if ($ENV{'request.symb'}) { return &symbclean($ENV{'request.symb'}); }
@@ -2750,7 +2750,7 @@
# ----------------------------------------------- There is only one possibility
my ($mapid,$resid)=split(/\./,$ids);
$syval=declutter($bighash{'map_id_'.$mapid}).'___'.$resid;
- } else {
+ } elsif (!$donotrecurse) {
# ------------------------------------------ There is more than one possibility
my $realpossible=0;
foreach (@possibilities) {
@@ -2765,6 +2765,8 @@
}
}
if ($realpossible!=1) { $syval=''; }
+ } else {
+ $syval='';
}
}
untie(%bighash)