Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: HASH error

by McA (Priest)
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
Replies are listed 'Best First'.
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 chilling in the Monastery: (16)
As of 2015-07-30 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls