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.25 by root, Thu Mar 29 02:45:49 2007 UTC vs.
Revision 1.30 by root, Mon Apr 9 06:37:40 2007 UTC

86package JSON::XS; 86package JSON::XS;
87 87
88use strict; 88use strict;
89 89
90BEGIN { 90BEGIN {
91 our $VERSION = '1.0'; 91 our $VERSION = '1.11';
92 our @ISA = qw(Exporter); 92 our @ISA = qw(Exporter);
93 93
94 our @EXPORT = qw(to_json from_json objToJson jsonToObj); 94 our @EXPORT = qw(to_json from_json objToJson jsonToObj);
95 require Exporter; 95 require Exporter;
96 96
309strings that look like integers or floats into integers or floats 309strings that look like integers or floats into integers or floats
310internally (there is no difference on the Perl level), saving space. 310internally (there is no difference on the Perl level), saving space.
311 311
312=item $json = $json->max_depth ([$maximum_nesting_depth]) 312=item $json = $json->max_depth ([$maximum_nesting_depth])
313 313
314Sets the maximum nesting level (default C<4096>) accepted while encoding 314Sets the maximum nesting level (default C<512>) accepted while encoding
315or decoding. If the JSON text or Perl data structure has an equal or 315or decoding. If the JSON text or Perl data structure has an equal or
316higher nesting level then this limit, then the encoder and decoder will 316higher nesting level then this limit, then the encoder and decoder will
317stop and croak at that point. 317stop and croak at that point.
318 318
319Nesting level is defined by number of hash- or arrayrefs that the encoder 319Nesting level is defined by number of hash- or arrayrefs that the encoder
473 $x *= 1; # same thing, the choise is yours. 473 $x *= 1; # same thing, the choise is yours.
474 474
475You can not currently output JSON booleans or force the type in other, 475You can not currently output JSON booleans or force the type in other,
476less obscure, ways. Tell me if you need this capability. 476less obscure, ways. Tell me if you need this capability.
477 477
478=item circular data structures
479
480Those will be encoded until memory or stackspace runs out.
481
482=back 478=back
483 479
484 480
485=head1 COMPARISON 481=head1 COMPARISON
486 482
636usually a good indication of the size of the resources required to decode 632usually a good indication of the size of the resources required to decode
637it into a Perl structure. 633it into a Perl structure.
638 634
639Third, JSON::XS recurses using the C stack when decoding objects and 635Third, JSON::XS recurses using the C stack when decoding objects and
640arrays. The C stack is a limited resource: for instance, on my amd64 636arrays. The C stack is a limited resource: for instance, on my amd64
641machine with 8MB of stack size I can decode around 180k nested arrays 637machine with 8MB of stack size I can decode around 180k nested arrays but
642but only 14k nested JSON objects. If that is exceeded, the program 638only 14k nested JSON objects (due to perl itself recursing deeply on croak
643crashes. Thats why the default nesting limit is set to 4096. If your 639to free the temporary). If that is exceeded, the program crashes. to be
640conservative, the default nesting limit is set to 512. If your process
644process has a smaller stack, you should adjust this setting accordingly 641has a smaller stack, you should adjust this setting accordingly with the
645with the C<max_depth> method. 642C<max_depth> method.
646 643
647And last but least, something else could bomb you that I forgot to think 644And last but least, something else could bomb you that I forgot to think
648of. In that case, you get to keep the pieces. I am alway sopen for hints, 645of. In that case, you get to keep the pieces. I am always open for hints,
649though... 646though...
650 647
651 648
652=head1 BUGS 649=head1 BUGS
653 650

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines