… | |
… | |
59 | =cut |
59 | =cut |
60 | |
60 | |
61 | package JSON::XS; |
61 | package JSON::XS; |
62 | |
62 | |
63 | BEGIN { |
63 | BEGIN { |
64 | $VERSION = '0.2'; |
64 | $VERSION = '0.3'; |
65 | @ISA = qw(Exporter); |
65 | @ISA = qw(Exporter); |
66 | |
66 | |
67 | @EXPORT = qw(to_json from_json); |
67 | @EXPORT = qw(to_json from_json); |
68 | require Exporter; |
68 | require Exporter; |
69 | |
69 | |
… | |
… | |
224 | |
224 | |
225 | Perl usually over-allocates memory a bit when allocating space for |
225 | Perl usually over-allocates memory a bit when allocating space for |
226 | strings. This flag optionally resizes strings generated by either |
226 | strings. This flag optionally resizes strings generated by either |
227 | C<encode> or C<decode> to their minimum size possible. This can save |
227 | C<encode> or C<decode> to their minimum size possible. This can save |
228 | memory when your JSON strings are either very very long or you have many |
228 | memory when your JSON strings are either very very long or you have many |
229 | short strings. |
229 | short strings. It will also try to downgrade any strings to octet-form |
|
|
230 | if possible: perl stores strings internally either in an encoding called |
|
|
231 | UTF-X or in octet-form. The latter cannot store everything but uses less |
|
|
232 | space in general. |
230 | |
233 | |
231 | If C<$enable> is true (or missing), the string returned by C<encode> will be shrunk-to-fit, |
234 | If C<$enable> is true (or missing), the string returned by C<encode> will be shrunk-to-fit, |
232 | while all strings generated by C<decode> will also be shrunk-to-fit. |
235 | while all strings generated by C<decode> will also be shrunk-to-fit. |
233 | |
236 | |
234 | If C<$enable> is false, then the normal perl allocation algorithms are used. |
237 | If C<$enable> is false, then the normal perl allocation algorithms are used. |