--- loncom/lonnet/perl/lonnet.pm 2007/08/31 12:33:29 1.909 +++ loncom/lonnet/perl/lonnet.pm 2007/09/12 03:40:35 1.911 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.909 2007/08/31 12:33:29 raeburn Exp $ +# $Id: lonnet.pm,v 1.911 2007/09/12 03:40:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -906,8 +906,8 @@ sub usersearch { if (&host_domain($tryserver) eq $dom) { my $host=&hostname($tryserver); my $queryid= - &reply("querysend:".&escape($query).':'.&escape($dom).':'. - &escape($srch->{'srchby'}).'%%'. + &reply("querysend:".&escape($query).':'. + &escape($srch->{'srchby'}).':'. &escape($srch->{'srchtype'}).':'. &escape($srch->{'srchterm'}),$tryserver); if ($queryid !~/^\Q$host\E\_/) { @@ -924,20 +924,23 @@ sub usersearch { if ( ($reply =~/^timeout/) || ($reply =~/^error/) ) { &logthis('usersrch error: '.$reply.' for '.$dom.' - searching for : '.$srch->{'srchterm'}.' by '.$srch->{'srchby'}.' ('.$srch->{'srchtype'}.') - maxtries: '.$maxtries.' tries: '.$tries); } else { - my @matches = split(/&/,$reply); + my @matches; + if ($reply =~ /\n/) { + @matches = split(/\n/,$reply); + } else { + @matches = split(/\&/,$reply); + } foreach my $match (@matches) { - my @items = split(/:/,$match); my ($uname,$udom,%userhash); - foreach my $entry (@items) { - my ($key,$value) = split(/=/,$entry); - $key = &unescape($key); - $value = &unescape($value); + foreach my $entry (split(/:/,$match)) { + my ($key,$value) = + map {&unescape($_);} split(/=/,$entry); $userhash{$key} = $value; if ($key eq 'username') { $uname = $value; } elsif ($key eq 'domain') { $udom = $value; - } + } } $results{$uname.':'.$udom} = \%userhash; } @@ -1223,8 +1226,10 @@ sub do_cache_new { $time=600; } if ($debug) { &Apache::lonnet::logthis("Setting $id to $value"); } - if (!($memcache->set($id,$setvalue,$time))) { + my $result = $memcache->set($id,$setvalue,$time); + if (! $result) { &logthis("caching of id -> $id failed"); + $memcache->disconnect_all(); } # need to make a copy of $value #&make_room($id,$value,$debug);