--- loncom/lonnet/perl/lonnet.pm 2002/07/04 15:47:18 1.250 +++ loncom/lonnet/perl/lonnet.pm 2002/07/04 15:56:17 1.251 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.250 2002/07/04 15:47:18 albertel Exp $ +# $Id: lonnet.pm,v 1.251 2002/07/04 15:56:17 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2278,25 +2278,17 @@ sub courseresdata { if (time-$courseresdatacache{$hashid.'.time'}>300) { $dodump=1; } } if ($dodump) { - my $coursehom=&homeserver($coursenum,$coursedomain); - if ($coursehom) { - my $dumpreply=&reply('dump:'.$coursedomain.':'.$coursenum. - ':resourcedata:.',$coursehom); - if ($dumpreply!~/^error\:/) { - $courseresdatacache{$hashid.'.time'}=time; - $courseresdatacache{$hashid}=$dumpreply; - } + my %dumpreply=&dump('resourcedata',$coursedomain,$coursenum); + my ($tmp) = keys(%dumpreply); + if ($tmp !~ /^(con_lost|error|no_such_host)/i) { + $courseresdatacache{$hashid.'.time'}=time; + $courseresdatacache{$hashid}=\%dumpreply; } } - my @pairs=split(/\&/,$courseresdatacache{$hashid}); - my %returnhash=(); - foreach (@pairs) { - my ($key,$value)=split(/=/,$_); - $returnhash{unescape($key)}=unescape($value); - } - my $item; - foreach $item (@which) { - if ($returnhash{$item}) { return $returnhash{$item}; } + foreach my $item (@which) { + if ($courseresdatacache{$hashid}->{$item}) { + return $courseresdatacache{$hashid}->{$item}; + } } return ''; }