correct denastification to handle single element dt_assoc (eg response to belongs_to_rsp)
authorjeff <jeff>
Sun, 27 Jun 2010 21:02:38 +0000 (21:02 +0000)
committerjeff <jeff>
Sun, 27 Jun 2010 21:02:38 +0000 (21:02 +0000)
Changes
lib/Net/OpenSRS.pm

diff --git a/Changes b/Changes
index 5c4d457..e362b8e 100644 (file)
--- 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)
index f1db5bf..07f2e3e 100644 (file)
@@ -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 );
     }