>>>>> "G" == Grant  <emailgr...@gmail.com> writes:

  >>  ForceArray => ['Image']

  G> I tried that and it seems to behave the same as 'ForceArray => 1'.
  G> Everything seems to be forced into an array.


that ForceArray should work as i have used it just like that. it will
only force arrays of the keys you pass to it. it is very useful for xml
which can be a single value or a list and the xml itself will be
different causing you to check the ref when you process it.

  G> I'm very happy to report that I got it working by using 'ForceArray =>
  G> 1' and specifying [0] to pick the first (and what should be the only)
  G> value from all of the new arrays.  I'm now using
  G> $parsed_response->{Label}[0]->{Image} in the foreach loop.  Is that a
  G> good solution?

no, that is overkill. it may work but you are wasting cpu and ram doing it.

show us how you are making the actual call to XMLin and its args. i
suspect you are not using forcearray correctly. it takes an anon array
reference and i bet you passed it a single string (which would act like
a 1 - true value).

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to