From: jeff Date: Sun, 27 Jun 2010 21:02:38 +0000 (+0000) Subject: correct denastification to handle single element dt_assoc (eg response to belongs_to_rsp) X-Git-Url: http://git.freeside.biz/gitweb/?p=Net-OpenSRS.git;a=commitdiff_plain;h=d9a576a11560f7ca71f66cd017fbcdd974053509 correct denastification to handle single element dt_assoc (eg response to belongs_to_rsp) --- diff --git a/Changes b/Changes index 5c4d457..e362b8e 100644 --- a/Changes +++ b/Changes @@ -11,3 +11,7 @@ 0.04 - Correct de-nastification to handle lists + +0.05 Sun Jun 27 16:54:23 EDT 2010 + - Correct de-nastification to handle single item dt_assoc + (eg belongs_to_rsp response) diff --git a/lib/Net/OpenSRS.pm b/lib/Net/OpenSRS.pm index f1db5bf..07f2e3e 100644 --- a/lib/Net/OpenSRS.pm +++ b/lib/Net/OpenSRS.pm @@ -150,7 +150,7 @@ use XML::Simple; use Digest::MD5; use Date::Calc qw/ Add_Delta_Days Today This_Year /; -our $VERSION = '0.04'; +our $VERSION = '0.05'; my $rv; *hash = \&Digest::MD5::md5_hex; @@ -1254,7 +1254,9 @@ sub _denastify { @$array ]; } elsif ( exists( $arg->{dt_assoc} ) ) { - $value = { map { _denastify($_) } @{ $arg->{dt_assoc} } }; + my $array = $arg->{dt_assoc}; + $array = [ $array ] unless ref($array) eq 'ARRAY'; + $value = { map { _denastify($_) } @$array }; } return ( $arg->{key} => $value ); }