[Opensrf-commits] r1666 - trunk/src/perl/lib/OpenSRF/Utils (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 17 13:04:42 EST 2009


Author: erickson
Date: 2009-02-17 13:04:39 -0500 (Tue, 17 Feb 2009)
New Revision: 1666

Modified:
   trunk/src/perl/lib/OpenSRF/Utils/JSON.pm
Log:
gotta protect the JSONObject2Perl() when decoding arrays as well

Modified: trunk/src/perl/lib/OpenSRF/Utils/JSON.pm
===================================================================
--- trunk/src/perl/lib/OpenSRF/Utils/JSON.pm	2009-02-17 17:48:54 UTC (rev 1665)
+++ trunk/src/perl/lib/OpenSRF/Utils/JSON.pm	2009-02-17 18:04:39 UTC (rev 1666)
@@ -80,11 +80,14 @@
 			return undef;
 		}
         for my $k (keys %$obj) {
-            $obj->{$k} = (ref($obj->{$k}) eq 'JSON::XS::Boolean') ? 
-                $obj->{$k} : $class->JSONObject2Perl($obj->{$k});
+            $obj->{$k} = $class->JSONObject2Perl($obj->{$k}) 
+                unless ref($obj->{$k}) eq 'JSON::XS::Boolean';
         }
 	} elsif( $ref eq 'ARRAY' ) {
-		$obj->[$_] = $class->JSONObject2Perl($obj->[$_]) for(0..scalar(@$obj) - 1);
+		for my $i (0..scalar(@$obj) - 1) {
+		    $obj->[$i] = $class->JSONObject2Perl($obj->[$i]) 
+                unless ref($obj->[$i]) eq 'JSON::XS::Boolean';
+        }
 	}
 	return $obj;
 }



More information about the opensrf-commits mailing list