SPUG: Help!!!!

BenRifkah Burnett benb at speakeasy.net
Fri Sep 30 14:20:56 PDT 2005


Louis.  From the information you give below it appears as though 
$responce is a hash reference.

Luis Medrano Zaldivar wrote:
>
>  
>
> Here is what I got:
>
>  
>
> my $responce = $rpc->call 
> ("blogger.getUsersBlogs",$key,$username,$password);
>
>  
>
> I need to extract what is on $responce meaning values and keys related 
> to those values.
>
'Keys' and 'Values' sounds like hash lingo.

However, from the snippet below it appears as though $responce is an 
array reference.
>
>  
> I'm modifying a script were has this variable @{$responce} and I need 
> to pull all the data from there but I don't recall how to do it. I 
> will appreciate if you can help me with this.
>  
>
The syntax @{$foo} means that $foo is a reference and you want to treat 
it like an array.

Do you know the what kind of variable $responce is?  To find out try 
calling the ref() function with $responce as the argument:

my $ref = ref($responce);
print STDERR "response is a :'$ref'";

This will tell you what kind of variable you are working with.

See the documentation for the ref function by running 'perldoc -f ref'

Once you know what kind of variable it is you can get to the information 
it holds in different ways.  See perldoc perlref for details on how to 
get information out of hash and array references depending on how you 
want to use it.

Also, $responce may not be a simple data structure.  Since it's being 
returned by the method 'call' on the $rpc object $responce may be an 
object itself.  Where did the $rpc object come from?  Do you know what 
"Class" it belongs to?  Documentation for this Class should tell you 
what to expect when you use the "call" method and how to get the 
information you need out of it.

Good Luck,

-- Ben Burnett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20050930/b3067f01/attachment.html


More information about the spug-list mailing list