Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Q about using soap lite to access AWS

Expand Messages
  • Duncan Cameron
    ... You should be getting a warning here Not an ARRAY reference You need to navigate down several levels of hash references for $item (@{$t- {BrowseList}}) {
    Message 1 of 2 , Nov 21, 2003
    • 0 Attachment
      At 22:37:30 on 2003-11-21 Michael J. Flynn <flynnmj@...> wrote:

      >Hello-
      >
      >I'm sure I'm missing something, but haven't found the answer in the docs
      >I've looked at. I found some code on soap.env that prints out a book
      >title and price for a keyword search. To further my understanding, I'm
      >trying to extend the code to pull out some more information. Simple nodes
      >in the Soap are fine. My problem comes up when I try to access the
      >browselist, which has child nodes under it. Any attempt to print out this
      >information comes out like "ARRAY(0x86536a0)". Seeing this output I
      >thought I would just need to make a referenece to this array and be able
      >to access the contents. I get the same array output as if I printed it
      >directly. Any pointers on how I can grab the nested nodes?
      >
      >Original code can be found here:
      >http://soapenv.org/article.pl?sid=02/07/18/1926233&mode=thread
      >
      >Code I'm focused on:
      >for my $t ($som->valueof('//KeywordSearchRequestResponse/return/Details/Details')) {
      > print $t->{ProductName} . " - " . $t->{OurPrice} . "\n";
      ># Code I added to the for loop.
      > print $t->{BrowseList} . "\n";
      > my @bl = @$t->{BrowseList};

      You should be getting a warning here "Not an ARRAY reference"

      You need to navigate down several levels of hash references

      for $item (@{$t->{BrowseList}}) {
      while( ($key, $value) = each %$item) {
      while( ($key2, $value2) = each %$value) {
      print "$key2 $value2\n"
      }
      }
      }


      Regards
      Duncan
    • Michael J. Flynn
      ... Duncan- Thanks for that code snippet. It got me on the right track, but I only needed 1 while loop since my structure isn t very deep. None of the examples
      Message 2 of 2 , Nov 22, 2003
      • 0 Attachment
        On Sat, 22 Nov 2003, Duncan Cameron wrote:

        > You should be getting a warning here "Not an ARRAY reference"
        >
        > You need to navigate down several levels of hash references
        >
        > for $item (@{$t->{BrowseList}}) {
        > while( ($key, $value) = each %$item) {
        > while( ($key2, $value2) = each %$value) {
        > print "$key2 $value2\n"
        > }
        > }
        > }

        Duncan-

        Thanks for that code snippet. It got me on the right track, but I only
        needed 1 while loop since my structure isn't very deep. None of the
        examples I came across had any real depth to their structure. I can see
        that all my problems came from the fact I didn't reference the array
        correctly.

        for $item (@{$t->{BrowseList}}) {
        while( ($key, $value) = each %$item) {
        print "\t$value\n";
        }
        }

        Laters

        mike flynn - flynnmj@...
        The Company Store - http://www.magpage.com/~flynnmj/tcs.html

        Brought to you by <B>Team SPAM!</B> where we believe:
        <I>"Information in the noise!"</I>
      Your message has been successfully submitted and would be delivered to recipients shortly.