Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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 prints as a 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 );

    "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.



Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-06-17 22:29 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.