Posted on 2009-11-20 04:19:54-08 by noah in response to 11776
Re: Returning array references with only one entry

AFAIK, there's no way to force this; indeed, SOAP::WSDL::Deserializer::Hash explicitly states that this is the behavior.

When I've encountered this issue, I've done something like the following:

my $list = ref( $response->{'List'} ) eq 'ARRAY' ? $response->{'List'} : [$response->{'List'}];

This ensures I always have an arrayref with which to work.

--noah
Direct Responses: 11785 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.