r37324 - in /branches/upstream/libjson-perl/current: Changes MANIFEST META.yml README lib/JSON.pm lib/JSON/PP.pm lib/JSON/PP5005.pm lib/JSON/PP56.pm t/21_evans_bugrep.t

nhandler-guest at users.alioth.debian.org nhandler-guest at users.alioth.debian.org
Wed Jun 3 03:02:03 UTC 2009


Author: nhandler-guest
Date: Wed Jun  3 03:01:58 2009
New Revision: 37324

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=37324
Log:
[svn-upgrade] Integrating new upstream version, libjson-perl (2.15)

Added:
    branches/upstream/libjson-perl/current/t/21_evans_bugrep.t
Modified:
    branches/upstream/libjson-perl/current/Changes
    branches/upstream/libjson-perl/current/MANIFEST
    branches/upstream/libjson-perl/current/META.yml
    branches/upstream/libjson-perl/current/README
    branches/upstream/libjson-perl/current/lib/JSON.pm
    branches/upstream/libjson-perl/current/lib/JSON/PP.pm
    branches/upstream/libjson-perl/current/lib/JSON/PP5005.pm
    branches/upstream/libjson-perl/current/lib/JSON/PP56.pm

Modified: branches/upstream/libjson-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-perl/current/Changes?rev=37324&op=diff
==============================================================================
--- branches/upstream/libjson-perl/current/Changes (original)
+++ branches/upstream/libjson-perl/current/Changes Wed Jun  3 03:01:58 2009
@@ -13,10 +13,17 @@
 
 ##########################################################################
 
+2.15  Tue Jun  2 16:36:42 2009
+	[JSON]
+	- made compatible with JSON::XS 2.24
+	- corrected copyrights in some modules.
+	[JSON::PP]
+	 - modified incr_parse, pointed by Martin J. Evans (rt#46439)
+	 - deleted a meaningless code
+
 2.14  Tue Feb 24 11:20:24 2009
-	[JSON] 
+	[JSON]
 	- the compatible XS version was miswritten in document.
-
 
 2.13  Sat Feb 21 17:01:05 2009
 	[JSON::PP]

Modified: branches/upstream/libjson-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-perl/current/MANIFEST?rev=37324&op=diff
==============================================================================
--- branches/upstream/libjson-perl/current/MANIFEST (original)
+++ branches/upstream/libjson-perl/current/MANIFEST Wed Jun  3 03:01:58 2009
@@ -31,6 +31,7 @@
 t/18_json_checker.t
 t/19_incr.t
 t/20_unknown.t
+t/21_evans_bugrep.t
 t/99_binary.t
 
 t/e00_func.t

Modified: branches/upstream/libjson-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-perl/current/META.yml?rev=37324&op=diff
==============================================================================
--- branches/upstream/libjson-perl/current/META.yml (original)
+++ branches/upstream/libjson-perl/current/META.yml Wed Jun  3 03:01:58 2009
@@ -1,14 +1,20 @@
 --- #YAML:1.0
-name:                JSON
-version:             2.14
-abstract:            JSON (JavaScript Object Notation) encoder/decoder
-license:             perl
-author:              
+name:               JSON
+version:            2.15
+abstract:           JSON (JavaScript Object Notation) encoder/decoder
+author:
     - Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
-generated_by:        ExtUtils::MakeMaker version 6.42
-distribution_type:   module
-requires:     
-    Test::More:                    0
+license:            perl
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+requires:
+    Test::More:  0
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.48
 meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
-    version: 1.3
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: branches/upstream/libjson-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-perl/current/README?rev=37324&op=diff
==============================================================================
--- branches/upstream/libjson-perl/current/README (original)
+++ branches/upstream/libjson-perl/current/README Wed Jun  3 03:01:58 2009
@@ -1,4 +1,4 @@
-JSON version 2.13
+JSON version 2.15
 =================
 
 INSTALLATION

Modified: branches/upstream/libjson-perl/current/lib/JSON.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-perl/current/lib/JSON.pm?rev=37324&op=diff
==============================================================================
--- branches/upstream/libjson-perl/current/lib/JSON.pm (original)
+++ branches/upstream/libjson-perl/current/lib/JSON.pm Wed Jun  3 03:01:58 2009
@@ -7,13 +7,13 @@
 @JSON::EXPORT = qw(from_json to_json jsonToObj objToJson encode_json decode_json);
 
 BEGIN {
-    $JSON::VERSION = '2.14';
+    $JSON::VERSION = '2.15';
     $JSON::DEBUG   = 0 unless (defined $JSON::DEBUG);
 }
 
 my $Module_XS  = 'JSON::XS';
 my $Module_PP  = 'JSON::PP';
-my $XS_Version = '2.22';
+my $XS_Version = '2.24';
 
 
 # XS and PP common methods
@@ -586,9 +586,9 @@
 
 =head1 VERSION
 
-    2.14
-
-This version is compatible with JSON::XS B<2.22> and later.
+    2.15
+
+This version is compatible with JSON::XS B<2.24> and later.
 
 
 =head1 DESCRIPTION
@@ -2058,7 +2058,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2005-2008 by Makamaka Hannyaharamitu
+Copyright 2005-2009 by Makamaka Hannyaharamitu
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 

Modified: branches/upstream/libjson-perl/current/lib/JSON/PP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-perl/current/lib/JSON/PP.pm?rev=37324&op=diff
==============================================================================
--- branches/upstream/libjson-perl/current/lib/JSON/PP.pm (original)
+++ branches/upstream/libjson-perl/current/lib/JSON/PP.pm Wed Jun  3 03:01:58 2009
@@ -11,7 +11,7 @@
 use B ();
 #use Devel::Peek;
 
-$JSON::PP::VERSION = '2.22010';
+$JSON::PP::VERSION = '2.24000';
 
 @JSON::PP::EXPORT = qw(encode_json decode_json from_json to_json);
 
@@ -489,7 +489,7 @@
     sub string_to_json {
         my ($self, $arg) = @_;
 
-        $arg =~ s/([\x22\x5c\n\r\t\f\b])/$esc{$1}/eg;
+        $arg =~ s/([\x22\x5c\n\r\t\f\b])/$esc{$1}/g;
         $arg =~ s/\//\\\//g if ($escape_slash);
         $arg =~ s/([\x00-\x08\x0b\x0e-\x1f])/'\\u00' . unpack('H2', $1)/eg;
 
@@ -1222,8 +1222,12 @@
         }
 
         Carp::croak (
-            $no_rep ? "$error" : "$error, at character offset $at [\"$mess\"]"
+            $no_rep ? "$error" : "$error, at character offset $at (before \"$mess\")"
         );
+
+#        Carp::croak (
+#            $no_rep ? "$error" : "$error, at character offset $at [\"$mess\"]"
+#        );
     }
 
 
@@ -1348,7 +1352,6 @@
         incr_text    => undef,
         incr_parsing => 0,
         incr_p       => 0,
-        
     }, $class;
 }
 
@@ -1394,8 +1397,8 @@
         else { # in scalar context
             $self->{incr_parsing} = 1;
             my $obj = $self->_incr_parse( $coder, $self->{incr_text} );
-            $self->{incr_parsing} = 0;
-            return $obj;
+            $self->{incr_parsing} = 0 if defined $obj; # pointed by Martin J. Evans
+            return $obj ? $obj : undef; # $obj is an empty string, parsing was completed.
         }
 
     }
@@ -1420,52 +1423,52 @@
        }
     }
 
-        while ( $len > $p ) {
-            my $s = substr( $text, $p++, 1 );
-
-            if ( $s eq '"' ) {
-                if ( $self->{incr_mode} != INCR_M_STR  ) {
-                    $self->{incr_mode} = INCR_M_STR;
-                }
-                else {
-                    $self->{incr_mode} = INCR_M_JSON;
-                    unless ( $self->{incr_nest} ) {
-                        last;
-                    }
-                }
-            }
-
-            if ( $self->{incr_mode} == INCR_M_JSON ) {
-
-                if ( $s eq '[' or $s eq '{' ) {
-                    if ( ++$self->{incr_nest} > $coder->get_max_depth ) {
-                        Carp::croak('json text or perl structure exceeds maximum nesting level (max_depth set too low?)');
-                    }
-                }
-                elsif ( $s eq ']' or $s eq '}' ) {
-                    last if ( --$self->{incr_nest} <= 0 );
-                }
-            }
-
-        }
-
-        $self->{incr_p} = $p;
-
-        return if ( $self->{incr_mode} == INCR_M_JSON and $self->{incr_nest} > 0 );
-
-        return unless ( length substr( $self->{incr_text}, 0, $p ) );
-
-        local $Carp::CarpLevel = 2;
-
-        $self->{incr_p} = $restore;
-        $self->{incr_c} = $p;
-
-        my ( $obj, $tail ) = $coder->decode_prefix( substr( $self->{incr_text}, 0, $p ) );
-
-        $self->{incr_text} = substr( $self->{incr_text}, $p );
-        $self->{incr_p} = 0;
-
-        return $obj;
+    while ( $len > $p ) {
+        my $s = substr( $text, $p++, 1 );
+
+        if ( $s eq '"' ) {
+            if ( $self->{incr_mode} != INCR_M_STR  ) {
+                $self->{incr_mode} = INCR_M_STR;
+            }
+            else {
+                $self->{incr_mode} = INCR_M_JSON;
+                unless ( $self->{incr_nest} ) {
+                    last;
+                }
+            }
+        }
+
+        if ( $self->{incr_mode} == INCR_M_JSON ) {
+
+            if ( $s eq '[' or $s eq '{' ) {
+                if ( ++$self->{incr_nest} > $coder->get_max_depth ) {
+                    Carp::croak('json text or perl structure exceeds maximum nesting level (max_depth set too low?)');
+                }
+            }
+            elsif ( $s eq ']' or $s eq '}' ) {
+                last if ( --$self->{incr_nest} <= 0 );
+            }
+        }
+
+    }
+
+    $self->{incr_p} = $p;
+
+    return if ( $self->{incr_mode} == INCR_M_JSON and $self->{incr_nest} > 0 );
+
+    return '' unless ( length substr( $self->{incr_text}, 0, $p ) );
+
+    local $Carp::CarpLevel = 2;
+
+    $self->{incr_p} = $restore;
+    $self->{incr_c} = $p;
+
+    my ( $obj, $tail ) = $coder->decode_prefix( substr( $self->{incr_text}, 0, $p ) );
+
+    $self->{incr_text} = substr( $self->{incr_text}, $p );
+    $self->{incr_p} = 0;
+
+    return $obj or '';
 }
 
 
@@ -2120,7 +2123,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2008 by Makamaka Hannyaharamitu
+Copyright 2007-2009 by Makamaka Hannyaharamitu
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 

Modified: branches/upstream/libjson-perl/current/lib/JSON/PP5005.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-perl/current/lib/JSON/PP5005.pm?rev=37324&op=diff
==============================================================================
--- branches/upstream/libjson-perl/current/lib/JSON/PP5005.pm (original)
+++ branches/upstream/libjson-perl/current/lib/JSON/PP5005.pm Wed Jun  3 03:01:58 2009
@@ -5,7 +5,7 @@
 
 my @properties;
 
-$JSON::PP5005::VERSION = '1.08';
+$JSON::PP5005::VERSION = '1.09';
 
 BEGIN {
 
@@ -139,7 +139,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2007-2008 by Makamaka Hannyaharamitu
+Copyright 2007-2009 by Makamaka Hannyaharamitu
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 

Modified: branches/upstream/libjson-perl/current/lib/JSON/PP56.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-perl/current/lib/JSON/PP56.pm?rev=37324&op=diff
==============================================================================
--- branches/upstream/libjson-perl/current/lib/JSON/PP56.pm (original)
+++ branches/upstream/libjson-perl/current/lib/JSON/PP56.pm Wed Jun  3 03:01:58 2009
@@ -5,7 +5,7 @@
 
 my @properties;
 
-$JSON::PP56::VERSION = '1.07';
+$JSON::PP56::VERSION = '1.08';
 
 BEGIN {
 
@@ -189,7 +189,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2007-2008 by Makamaka Hannyaharamitu
+Copyright 2007-2009 by Makamaka Hannyaharamitu
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 

Added: branches/upstream/libjson-perl/current/t/21_evans_bugrep.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-perl/current/t/21_evans_bugrep.t?rev=37324&op=file
==============================================================================
--- branches/upstream/libjson-perl/current/t/21_evans_bugrep.t (added)
+++ branches/upstream/libjson-perl/current/t/21_evans_bugrep.t Wed Jun  3 03:01:58 2009
@@ -1,0 +1,51 @@
+use strict;
+use Test::More;
+
+BEGIN { plan tests => 6 };
+
+#BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
+BEGIN { $ENV{PERL_JSON_BACKEND} = ($ARGV[0] || 0); }
+
+BEGIN {
+    use lib qw(t);
+    use _unicode_handling;
+}
+
+
+use JSON;
+
+print JSON->backend, "\t", JSON->backend->VERSION, "\n";
+
+my $data = ["\x{3042}\x{3044}\x{3046}\x{3048}\x{304a}",
+            "\x{304b}\x{304d}\x{304f}\x{3051}\x{3053}"];
+
+my $j = new JSON;
+my $js = $j->encode($data);
+$j = undef;
+
+my @parts = (substr($js, 0, int(length($js) / 2)),
+             substr($js, int(length($js) / 2)));
+$j = JSON->new;
+my $object = $j->incr_parse($parts[0]);
+
+ok( !defined $object );
+
+eval {
+    $j->incr_text;
+};
+
+like( $@, qr/incr_text can not be called when the incremental parser already started parsing/ );
+
+$object = $j->incr_parse($parts[1]);
+
+ok( defined $object );
+
+is( $object->[0], $data->[0] );
+is( $object->[1], $data->[1] );
+
+eval {
+    $j->incr_text;
+};
+
+ok( !$@ );
+




More information about the Pkg-perl-cvs-commits mailing list