--- loncom/lonnet/perl/lonnet.pm 2002/07/04 15:47:18 1.250 +++ loncom/lonnet/perl/lonnet.pm 2002/07/17 18:01:33 1.252 @@ -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.252 2002/07/17 18:01:33 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 ''; } @@ -2956,13 +2948,17 @@ BEGIN { while (my $configline=<$config>) { chomp($configline); my ($id,$domain,$role,$name,$ip,$domdescr)=split(/:/,$configline); - $hostname{$id}=$name; - $hostdom{$id}=$domain; - $hostip{$id}=$ip; - if ($domdescr) { - $domaindescription{$domain}=$domdescr; + if ($id && $domain && $role && $name && $ip) { + $hostname{$id}=$name; + $hostdom{$id}=$domain; + $hostip{$id}=$ip; + if ($domdescr) { $domaindescription{$domain}=$domdescr; } + if ($role eq 'library') { $libserv{$id}=$name; } + } else { + if ($configline) { + &logthis("Skipping hosts.tab line -$configline-"); + } } - if ($role eq 'library') { $libserv{$id}=$name; } } }