summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-05-22 08:55:45 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-05-22 08:55:45 +0100
commitb9ec7747098f822b14e1563bcfa6859adb897351 (patch)
tree347e8a18461637eb90ed5726c514f43932caddc4
parent61b833cb5913a18d5aa93a3f3db9c41d7e091930 (diff)
downloadperl-smoke-me/cpan.tar.gz
Updated JSON-PP to CPAN version 2.27200smoke-me/cpan
[DELTA] 2.27200 Sun May 22 12:17:51 2011 - fixed incr_parse docodeing string more correctly (rt#68032 by LCONS)
-rw-r--r--MANIFEST1
-rwxr-xr-xPorting/Maintainers.pl2
-rw-r--r--cpan/JSON-PP/lib/JSON/PP.pm21
-rw-r--r--cpan/JSON-PP/t/116_incr_parse_fixed.t25
4 files changed, 40 insertions, 9 deletions
diff --git a/MANIFEST b/MANIFEST
index b907ea1f66..849c6f7547 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1385,6 +1385,7 @@ cpan/JSON-PP/t/112_upgrade.t
cpan/JSON-PP/t/113_overloaded_eq.t
cpan/JSON-PP/t/114_decode_prefix.t
cpan/JSON-PP/t/115_tie_ixhash.t
+cpan/JSON-PP/t/116_incr_parse_fixed.t
cpan/JSON-PP/t/_unicode_handling.pm
cpan/libnet/Changes libnet
cpan/libnet/Config.eg libnet
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 1dfccd11e7..c564c33bb0 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1088,7 +1088,7 @@ use File::Glob qw(:case);
'JSON::PP' =>
{
'MAINTAINER' => 'makamaka',
- 'DISTRIBUTION' => 'MAKAMAKA/JSON-PP-2.27105.tar.gz',
+ 'DISTRIBUTION' => 'MAKAMAKA/JSON-PP-2.27200.tar.gz',
'FILES' => q[cpan/JSON-PP],
'EXCLUDED' => [
't/900_pod.t', # Pod testing
diff --git a/cpan/JSON-PP/lib/JSON/PP.pm b/cpan/JSON-PP/lib/JSON/PP.pm
index cef9f42175..2e617fc622 100644
--- a/cpan/JSON-PP/lib/JSON/PP.pm
+++ b/cpan/JSON-PP/lib/JSON/PP.pm
@@ -11,7 +11,7 @@ use Carp ();
use B ();
#use Devel::Peek;
-$JSON::PP::VERSION = '2.27105';
+$JSON::PP::VERSION = '2.27200';
@JSON::PP::EXPORT = qw(encode_json decode_json from_json to_json);
@@ -1459,7 +1459,7 @@ sub incr_parse {
if ( defined wantarray ) {
- $self->{incr_mode} = INCR_M_WS;
+ $self->{incr_mode} = INCR_M_WS unless defined $self->{incr_mode};
if ( wantarray ) {
my @ret;
@@ -1470,10 +1470,10 @@ sub incr_parse {
push @ret, $self->_incr_parse( $coder, $self->{incr_text} );
unless ( !$self->{incr_nest} and $self->{incr_mode} == INCR_M_JSON ) {
- $self->{incr_mode} = INCR_M_WS;
+ $self->{incr_mode} = INCR_M_WS if $self->{incr_mode} != INCR_M_STR;
}
- } until ( !$self->{incr_text} );
+ } until ( length $self->{incr_text} >= $self->{incr_p} );
$self->{incr_parsing} = 0;
@@ -1512,6 +1512,10 @@ sub _incr_parse {
my $s = substr( $text, $p++, 1 );
if ( $s eq '"' ) {
+ if (substr( $text, $p - 2, 1 ) eq '\\' ) {
+ next;
+ }
+
if ( $self->{incr_mode} != INCR_M_STR ) {
$self->{incr_mode} = INCR_M_STR;
}
@@ -1545,6 +1549,7 @@ sub _incr_parse {
$self->{incr_p} = $p;
+ return if ( $self->{incr_mode} == INCR_M_STR and not $self->{incr_nest} );
return if ( $self->{incr_mode} == INCR_M_JSON and $self->{incr_nest} > 0 );
return '' unless ( length substr( $self->{incr_text}, 0, $p ) );
@@ -1625,9 +1630,9 @@ JSON::PP - JSON::XS compatible pure-Perl module.
=head1 VERSION
- 2.27105
+ 2.27200
-L<JSON::XS> 2.27 compatible.
+L<JSON::XS> 2.27 (~2.30) compatible.
=head1 NOTE
@@ -1826,7 +1831,7 @@ Basically, check to L<JSON> or L<JSON::XS>.
=head2 new
- $json = new JSON::PP
+ $json = JSON::PP->new
Rturns a new JSON::PP object that can be used to de/encode JSON
strings.
@@ -2804,7 +2809,7 @@ Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
-Copyright 2007-2010 by Makamaka Hannyaharamitu
+Copyright 2007-2011 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
diff --git a/cpan/JSON-PP/t/116_incr_parse_fixed.t b/cpan/JSON-PP/t/116_incr_parse_fixed.t
new file mode 100644
index 0000000000..73c2462bf3
--- /dev/null
+++ b/cpan/JSON-PP/t/116_incr_parse_fixed.t
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More tests => 4;
+
+use JSON::PP;
+
+my $json = JSON::PP->new->allow_nonref();
+
+my @vs = $json->incr_parse('"a\"bc');
+
+ok( not scalar(@vs) );
+
+@vs = $json->incr_parse('"');
+
+is( $vs[0], "a\"bc" );
+
+
+$json = JSON::PP->new;
+
+@vs = $json->incr_parse('"a\"bc');
+ok( not scalar(@vs) );
+@vs = eval { $json->incr_parse('"') };
+ok($@ =~ qr/JSON text must be an object or array/);
+