Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: HASH error

by McA (Curate)
on Sep 13, 2013 at 06:52 UTC ( #1053851=note: print w/ replies, xml ) Need Help??


in reply to HASH error

Put a

print Dumper($ref), "\n";

before the line

foreach my $oid (values %{$ref->{OBJECT}}) {

and show us the output. You also have to put a

use Data::Dumper;

below the line

use JSON;

McA


Comment on Re: HASH error
Select or Download Code
Re^2: HASH error
by Sententiosus (Initiate) on Sep 13, 2013 at 08:21 UTC

    thanks McA

    the Output

    $VAR1 = { 'OBJECT' => { 'PROPERTY' => [ { 'content' => 'error', 'name' => 'response-type' }, { 'content' => '1', 'name' => 'response-type-numer +ic' }, { 'content' => 'Unauthorized acc +ess requested', 'name' => 'response' }, { 'content' => '6', 'name' => 'return-code' } ], 'oid' => '1', 'name' => 'status', 'basetype' => 'status' } }; Not a HASH reference at ./hp-msa.pl line 19.

      As I'm not the author of that program I can only guess. Please change the line:

      my $ref = XMLin($res->content, KeyAttr => "oid");

      to the following

      my $ref = XMLin($res->content, KeyAttr => "oid", ForceArray => [ 'OBJE +CT' ]);

      and give it a try.

      McA

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053851]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2014-09-02 02:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls