in reply to Re^3: SOAP::Lite and hash of hashes
in thread SOAP::Lite and hash of hashes
gives Can't locate object method "result" via package "_content" (perhaps you forgot to load "_content"?) at ./searchPeople.plforeach my $r (keys %$result){ print $r->result->{Person}->{commonname}; }
works for a unique item i.e. login id but gives the pseudo hash deprecated error and bad index error as aboveforeach my $r ($result->result){ print $r->{Person}->{commonname}; }
Gives 'not an ARRAY reference'.foreach my $r (@$result){ print $r->result->{Person}->{commonname}; }
This is output from data dumper when the search method is given 'shaw', ive truncated a load of other data and other people for demo purposes:
Looking at this then, is Person an array and not a hash? How would i get at each element of the person array if it is?$VAR1 = { 'Person' => [ { 'commonname' => 'person 1', 'location' => 'location 1', 'telephonenumber' => '34567688', 'surname' => 'Shaw' }, { 'commonname' => 'person 2', 'location' => 'location 2', 'telephonenumber' => '1234576', 'surname' => 'Birkinshaw' }
The search method isnt part of the SOAP::Lite docs - its a web method from my webservice.
Thanks
Joe
UPDATE I can get at the second person using
print $result->result->{Person}[1]->{commonname};
Now all i need is a loop...thanks
-----
Eschew obfuscation, espouse eludication!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: SOAP::Lite and hash of hashes
by jethro (Monsignor) on Feb 12, 2009 at 16:09 UTC | |
by joec_ (Scribe) on Feb 12, 2009 at 16:16 UTC |