ooops... octal ;)
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 4 Aug 2005 18:36:19 +0000 (18:36 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 4 Aug 2005 18:36:19 +0000 (18:36 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1609 dcc99617-32d9-48b4-a31d-7c20da2025e4

OpenSRF/src/perlmods/JSON.pm

index 1f1177c..13db444 100644 (file)
@@ -223,7 +223,7 @@ sub perl2JSON {
                $perl =~ s/\r/\\r/sgo;
                $perl =~ s/\n/\\n/sgo;
                $perl =~ s/(\pM)/sprintf('\u%0.4x',ord($1))/sgoe;
-               if (length($perl) < 10 and $perl =~ /^(?:\+|-)?\d*\.?\d+$/) {
+               if (length($perl) < 10 and $perl =~ /^(?:\+|-)?\d*\.?\d+$/o and $perl !~ /^(?:\+|-)?0\d+/o ) {
                        $output = $perl;
                } else {
                        $output = '"'.$perl.'"';
@@ -303,6 +303,11 @@ sub perl2prettyJSON {
                $perl =~ s/\n/\\n/sgo;
                $perl =~ s/(\pM)/sprintf('\u%0.4x',ord($1))/sgoe;
                $output .= "   "x$depth unless($nospace);
+               if (length($perl) < 10 and $perl =~ /^(?:\+|-)?\d*\.?\d+$/o and $perl !~ /^(?:\+|-)?0\d+/o ) {
+                       $output = $perl;
+               } else {
+                       $output = '"'.$perl.'"';
+               }
                $output .= '"'.$perl.'"';
        }