Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

How to decode a hash value

by Anonymous Monk
on May 14, 2012 at 00:01 UTC ( [id://970361]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Everytime I try to print below value.it prints as a hash..how to decode it?

my $response = $QMIService->GetResponse ($token,60000); print "\nRESPONSE:$response";-->prints RESPONSE:QMIResponse=HAS +H(0xe68d4d4)

Replies are listed 'Best First'.
Re: How to decode a hash value
by sauoq (Abbot) on May 14, 2012 at 00:27 UTC

    You just want to see what's in it?

    use Data::Dumper; print Dumper( $response );

    -sauoq
    "My two cents aren't worth a dime.";
Re: How to decode a hash value
by kcott (Archbishop) on May 14, 2012 at 00:45 UTC

    $response is a reference to a hash blessed into the QMIResponse class (I couldn't find this module on CPAN). You can dereference with %$response for the whole hash, @{$response}{@slice_keys} for a hash slice or $response->{$key} for individual values.

    However, before trying to access that data directly, look for methods provided by the QMIResponse class for doing this. Using the methods provided by the class means that $response->get_whatever() still works long after QMIResponse=HASH(0xe68d4d4) becomes QMIResponse=ARRAY(0xe68d4d4) or QMIResponse=SCALAR(0xe68d4d4).

    -- Ken

Re: How to decode a hash value
by AnomalousMonk (Archbishop) on May 14, 2012 at 00:40 UTC
    my $response = $QMIService->GetResponse ($token,60000);

    I have no experience with the QMIResponse module (don't even know where it might be found; it's not on CPAN), but this method call is almost certainly returning an object reference of some kind. Check the QMIResponse (and related module) docs for methods that access object instance data.

Re: How to decode a hash value
by planetscape (Chancellor) on May 14, 2012 at 09:59 UTC

    For future reference, please see References.

    HTH,

    planetscape

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://970361]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-25 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found