From: miker Date: Thu, 28 Jul 2005 21:35:32 +0000 (+0000) Subject: passing numbers as bare strings X-Git-Tag: osrf_rel_2_0_1~1431 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5dc90dead7f8007fd33796caaa28239b86ec0323;p=OpenSRF.git passing numbers as bare strings git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@442 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/JSON.pm b/src/perlmods/JSON.pm index ece6bb0..0b0e16b 100644 --- a/src/perlmods/JSON.pm +++ b/src/perlmods/JSON.pm @@ -223,7 +223,11 @@ sub perl2JSON { $perl =~ s/\r/\\r/sgo; $perl =~ s/\n/\\n/sgo; $perl =~ s/(\pM)/sprintf('\u%0.4x',ord($1))/sgoe; - $output = '"'.$perl.'"'; + if ($perl =~ /^(?:\+|-)?\d*\.?\d+$/) { + $output = $perl; + } else { + $output = '"'.$perl.'"'; + } } return $output;