--- loncom/lonnet/perl/lonnet.pm 2001/07/26 17:22:19 1.129 +++ loncom/lonnet/perl/lonnet.pm 2001/07/26 20:44:42 1.132 @@ -41,7 +41,13 @@ # if they aren't given they will be derived from the # current enviroment # eget(namesp,array) : returns hash with keys from array filled in from namesp -# get(namesp,array) : returns hash with keys from array filled in from namesp +# get(namesp,arrayref,udom,uname) +# : returns hash with keys from array reference filled +# in from namesp +# if supplied uses udom as the domain and uname +# as the username for the dump (supply a courseid +# for the uname if you want a course database) +# if not supplied it uses %ENV to get the values # del(namesp,array) : deletes keys out of array from namesp # put(namesp,hash) : stores hash in namesp # cput(namesp,hash) : critical put @@ -49,6 +55,7 @@ # if supplied uses udom as the domain and uname # as the username for the dump (supply a courseid # for the uname if you want a course database) +# if not supplied it uses %ENV to get the values # ssi(url,hash) : does a complete request cycle on url to localhost, posts # hash # coursedescription(id) : returns and caches course description for id @@ -796,7 +803,7 @@ sub coursedescription { $returnhash{'home'}= $chome; $returnhash{'domain'} = $cdomain; $returnhash{'num'} = $cnum; - while (my ($name,$value) = each %ENV) { + while (my ($name,$value) = each %returnhash) { $envhash{'course.'.$normalid.'.'.$name}=$value; } $returnhash{'url'}='/res/'.declutter($returnhash{'url'}); @@ -915,21 +922,24 @@ sub rolesinit { # --------------------------------------------------------------- get interface sub get { - my ($namespace,@storearr)=@_; + my ($namespace,$storearr,$udomain,$uname)=@_; my $items=''; map { $items.=escape($_).'&'; - } @storearr; + } @$storearr; $items=~s/\&$//; - my $rep=reply("get:$ENV{'user.domain'}:$ENV{'user.name'}:$namespace:$items", - $ENV{'user.home'}); + if (!$udomain) { $udomain=$ENV{'user.domain'}; } + if (!$uname) { $uname=$ENV{'user.name'}; } + my $uhome=&homeserver($uname,$udomain); + + my $rep=reply("get:$udomain:$uname:$namespace:$items",$uhome); my @pairs=split(/\&/,$rep); my %returnhash=(); my $i=0; map { $returnhash{$_}=unescape($pairs[$i]); $i++; - } @storearr; + } @$storearr; return %returnhash; } @@ -1705,7 +1715,7 @@ sub EXT { # ---------------------------------------------------- Any other user namespace } else { my $item=($rest)?$qualifier.'.'.$rest:$qualifier; - my %reply=&get($space,$item); + my %reply=&get($space,[$item]); return $reply{$item}; } } elsif ($realm eq 'request') { @@ -1748,7 +1758,7 @@ sub EXT { # ----------------------------------------------------------- first, check user my %resourcedata=get('resourcedata', - ($courselevelr,$courselevelm,$courselevel)); + [$courselevelr,$courselevelm,$courselevel]); if (($resourcedata{$courselevelr}!~/^error\:/) && ($resourcedata{$courselevelr}!~/^con_lost/)) {