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

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 17 12:47:20 EST 2009


Author: erickson
Date: 2009-02-17 12:47:18 -0500 (Tue, 17 Feb 2009)
New Revision: 1664

Modified:
   trunk/src/perl/lib/OpenSRF/Utils/JSON.pm
Log:

not sure why this is an issue now (different perl/json:xs verions?), but 
$obj->{$k} = JSONObject2Perl($bool) 
results in 'Modification of a read-only value attempted', while 
$obj->{$k} = $bool 
does not, even though the JSON::XS::Boolean object is not altered by JSONObject2Perl().  
just missing something? 
patched




Modified: trunk/src/perl/lib/OpenSRF/Utils/JSON.pm
===================================================================
--- trunk/src/perl/lib/OpenSRF/Utils/JSON.pm	2009-02-15 16:10:12 UTC (rev 1663)
+++ trunk/src/perl/lib/OpenSRF/Utils/JSON.pm	2009-02-17 17:47:18 UTC (rev 1664)
@@ -79,7 +79,10 @@
 			}
 			return undef;
 		}
-		$obj->{$_} = $class->JSONObject2Perl($obj->{$_}) for (keys %$obj);
+        for my $k (keys %$obj) {
+            $obj->{$k} = (ref($obj->{$k}) eq 'JSON::XS::Boolean') ? 
+                $obj->{$k} : $class->JSONObject2Perl($obj->{$k});
+        }
 	} elsif( $ref eq 'ARRAY' ) {
 		$obj->[$_] = $class->JSONObject2Perl($obj->[$_]) for(0..scalar(@$obj) - 1);
 	}



More information about the opensrf-commits mailing list