--- JSON-XS/XS.pm 2007/05/09 16:10:37 1.33 +++ JSON-XS/XS.pm 2007/05/09 16:33:53 1.34 @@ -88,7 +88,7 @@ use strict; BEGIN { - our $VERSION = '1.12'; + our $VERSION = '1.2'; our @ISA = qw(Exporter); our @EXPORT = qw(to_json from_json objToJson jsonToObj); @@ -376,6 +376,20 @@ Perl arrayrefs and JSON objects become Perl hashrefs. C becomes C<1>, C becomes C<0> and C becomes C. +=item ($perl_scalar, $characters) = $json->decode_prefix ($json_text) + +This works like the C method, but instead of raising an exception +when there is trailing garbage after the first JSON object, it will +silently stop parsing there and return the number of characters consumed +so far. + +This is useful if your JSON texts are not delimited by an outer protocol +(which is not the brightest thing to do in the first place) and you need +to know where the JSON text ends. + + JSON::XS->new->decode_prefix ("[1] the tail") + => ([], 3) + =back