ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/XS.pm
(Generate patch)

Comparing JSON-XS/XS.pm (file contents):
Revision 1.55 by root, Mon Jul 23 22:57:40 2007 UTC vs.
Revision 1.56 by root, Thu Jul 26 11:33:35 2007 UTC

81 81
82package JSON::XS; 82package JSON::XS;
83 83
84use strict; 84use strict;
85 85
86our $VERSION = '1.42'; 86our $VERSION = '1.43';
87our @ISA = qw(Exporter); 87our @ISA = qw(Exporter);
88 88
89our @EXPORT = qw(to_json from_json); 89our @EXPORT = qw(to_json from_json);
90 90
91use Exporter; 91use Exporter;
553are represented by the same codepoints in the Perl string, so no manual 553are represented by the same codepoints in the Perl string, so no manual
554decoding is necessary. 554decoding is necessary.
555 555
556=item number 556=item number
557 557
558A JSON number becomes either an integer or numeric (floating point) 558A JSON number becomes either an integer, numeric (floating point) or
559scalar in perl, depending on its range and any fractional parts. On the 559string scalar in perl, depending on its range and any fractional parts. On
560Perl level, there is no difference between those as Perl handles all the 560the Perl level, there is no difference between those as Perl handles all
561conversion details, but an integer may take slightly less memory and might 561the conversion details, but an integer may take slightly less memory and
562represent more values exactly than (floating point) numbers. 562might represent more values exactly than (floating point) numbers.
563
564If the number consists of digits only, JSON::XS will try to represent
565it as an integer value. If that fails, it will try to represent it as
566a numeric (floating point) value if that is possible without loss of
567precision. Otherwise it will preserve the number as a string value.
568
569Numbers containing a fractional or exponential part will always be
570represented as numeric (floating point) values, possibly at a loss of
571precision.
572
573This might create round-tripping problems as numbers might become strings,
574but as Perl is typeless there is no other way to do it.
563 575
564=item true, false 576=item true, false
565 577
566These JSON atoms become C<JSON::XS::true> and C<JSON::XS::false>, 578These JSON atoms become C<JSON::XS::true> and C<JSON::XS::false>,
567respectively. They are overloaded to act almost exactly like the numbers 579respectively. They are overloaded to act almost exactly like the numbers

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines