r29745 - in /branches/upstream/libjson-any-perl/current: ._Makefile.PL Changes MANIFEST META.yml Makefile.PL lib/JSON/._Any.pm lib/JSON/Any.pm t/._00-load.t t/._01-JSON.t t/10_unicode.t t/11-string-escape.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sat Jan 17 11:45:37 UTC 2009


Author: ansgar-guest
Date: Sat Jan 17 11:45:34 2009
New Revision: 29745

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

Added:
    branches/upstream/libjson-any-perl/current/t/11-string-escape.t
Removed:
    branches/upstream/libjson-any-perl/current/._Makefile.PL
    branches/upstream/libjson-any-perl/current/lib/JSON/._Any.pm
    branches/upstream/libjson-any-perl/current/t/._00-load.t
    branches/upstream/libjson-any-perl/current/t/._01-JSON.t
Modified:
    branches/upstream/libjson-any-perl/current/Changes
    branches/upstream/libjson-any-perl/current/MANIFEST
    branches/upstream/libjson-any-perl/current/META.yml
    branches/upstream/libjson-any-perl/current/Makefile.PL
    branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm
    branches/upstream/libjson-any-perl/current/t/10_unicode.t

Modified: branches/upstream/libjson-any-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/Changes?rev=29745&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/Changes (original)
+++ branches/upstream/libjson-any-perl/current/Changes Sat Jan 17 11:45:34 2009
@@ -1,4 +1,8 @@
 Revision history for JSON-Any
+1.19    2009-01-15
+        * Make JSON::Syck optional and deprecated. (perigrin)
+        * Added tests for string escapes. (semifor)
+
 1.18	2008-11-12
 	* Removed JSON::PC support as it's been removed from CPAN (perigrin)
 

Modified: branches/upstream/libjson-any-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/MANIFEST?rev=29745&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/MANIFEST (original)
+++ branches/upstream/libjson-any-perl/current/MANIFEST Sat Jan 17 11:45:34 2009
@@ -23,3 +23,4 @@
 t/04-ENV.t
 t/05-JSON-Syck.t
 t/10_unicode.t
+t/11-string-escape.t

Modified: branches/upstream/libjson-any-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/META.yml?rev=29745&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/META.yml (original)
+++ branches/upstream/libjson-any-perl/current/META.yml Sat Jan 17 11:45:34 2009
@@ -20,4 +20,4 @@
   Carp: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: 1.18
+version: 1.19

Modified: branches/upstream/libjson-any-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/Makefile.PL?rev=29745&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/Makefile.PL (original)
+++ branches/upstream/libjson-any-perl/current/Makefile.PL Sat Jan 17 11:45:34 2009
@@ -9,7 +9,7 @@
 requires 'Carp' => '0';
 
 sub has_json () {
-    @order = qw(XS JSON DWIW Syck);
+    @order = qw(XS JSON DWIW);
     foreach my $testmod (@order) {
         $testmod = "JSON::$testmod" unless $testmod eq "JSON";
         eval "require $testmod";

Modified: branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm?rev=29745&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm (original)
+++ branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm Sat Jan 17 11:45:34 2009
@@ -20,7 +20,7 @@
 
 =cut
 
-our $VERSION = '1.18';
+our $VERSION = '1.19';
 
 our $UTF8;
 
@@ -201,7 +201,7 @@
 
     @order = split /\s/, $ENV{JSON_ANY_ORDER}
       if !@order and $ENV{JSON_ANY_ORDER};
-    @order = qw(XS JSON DWIW Syck) unless @order;
+    @order = qw(XS JSON DWIW) unless @order;
 
     foreach my $testmod (@order) {
         $testmod = "JSON::$testmod" unless $testmod eq "JSON";
@@ -259,13 +259,12 @@
 	JSON::XS 
 	JSON 
 	JSON::DWIW 
-	JSON::Syck
 
 And loading the first one it finds.
 
 You may change the order by specifying it on the C<use JSON::Any> line:
 
-	use JSON::Any qw(DWIW Syck XS JSON);
+	use JSON::Any qw(DWIW XS JSON);
 
 Specifying an order that is missing one of the modules will prevent that module from being used:
 
@@ -273,6 +272,17 @@
 
 This will check in that order, and will never attempt to load JSON::Syck. This can also be set via
 the $ENV{JSON_ANY_ORDER} environment variable.
+
+JSON::Syck has been deprecated by it's author, but in the attempt to still stay relevant as a "Compat Layer" 
+JSON::Any still supports it. This support however has been made optional, and disabled by default. If you would like
+to use JSON::Any with version 1.19 and above you'll need to explicitly add it to the import list.
+
+    use JSON::Any qw(Syck XS JSON); 
+    
+or 
+
+    $ENV{JSON_ANY_ORDER} = 'Syck XS JSON';
+
 
 WARNING: If you call JSON::Any with an empty list
 
@@ -505,7 +515,8 @@
 =head1 AUTHOR
 
 Chris Thompson, C<< <cthom at cpan.org> >>
-Chris Prather, C<< <perigrin at cpan.org> >>
+Chris Prather, C<< <chris at prather.org> >>
+Robin Berjon, C<< robin at berjon.com >>
 
 =head1 BUGS
 
@@ -530,7 +541,7 @@
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2007 Chris Thompson, some rights reserved.
+Copyright 2007-2009 Chris Thompson, some rights reserved.
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

Modified: branches/upstream/libjson-any-perl/current/t/10_unicode.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/t/10_unicode.t?rev=29745&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/t/10_unicode.t (original)
+++ branches/upstream/libjson-any-perl/current/t/10_unicode.t Sat Jan 17 11:45:34 2009
@@ -13,7 +13,7 @@
 
 $ENV{JSON_ANY_CONFIG} = "utf8=1";
 
-foreach my $backend qw(XS JSON DWIW Syck PC) {
+foreach my $backend qw(XS JSON DWIW Syck) {
     my $j = eval {
         JSON::Any->import($backend);
         JSON::Any->new;

Added: branches/upstream/libjson-any-perl/current/t/11-string-escape.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/t/11-string-escape.t?rev=29745&op=file
==============================================================================
--- branches/upstream/libjson-any-perl/current/t/11-string-escape.t (added)
+++ branches/upstream/libjson-any-perl/current/t/11-string-escape.t Sat Jan 17 11:45:34 2009
@@ -1,0 +1,83 @@
+#!perl
+$!++;
+use strict;
+use Data::Dumper;
+use Test::More;
+
+use Storable;
+
+eval "use JSON::Any";
+
+if ($@) {
+    plan skip_all => "$@";
+    exit;
+}
+
+$Data::Dumper::Indent = 0;
+$Data::Dumper::Terse  = 1;
+
+my @round_trip = (
+    '"\""',
+    '"\b"',
+    '"\f"',
+    '"\n"',
+    '"\r"',
+    '"\t"',
+    '"\u0001"',
+);
+
+# Seems most handlers decode the escaped slash (solidus), but don't
+# encode it escaped.  TODO: What does the spec *really* say?
+# For now, just test decoding.  Improper decoding breaks things.
+my %one_way = (
+    '"\/"' => '/',  # escaped solidus
+);
+
+test ($_) for qw(XS JSON DWIW);
+
+TODO: { 
+    local $TODO = q[JSON::Syck doesn't escape things properly];
+    test ($_) for qw(Syck);
+}
+
+sub test {
+    my ($backend) = @_;
+    my $j = eval {
+        JSON::Any->import($backend);
+        JSON::Any->new;
+    };
+
+    diag "$backend: " . $@ and next if $@;
+
+    $j and $j->handler or next;
+
+    diag "handler is " . ( ref( $j->handler ) || $j->handlerType );
+
+    plan 'no_plan' unless $ENV{JSON_ANY_RAN_TESTS};
+    $ENV{JSON_ANY_RAN_TESTS} = 1;
+    
+    for my $test_orig ( @round_trip ) {
+        my $test = "[$test_orig]"; # make it an array
+        my $data = eval { JSON::Any->jsonToObj($test) };
+        my $json = JSON::Any->objToJson($data);
+
+        # don't bother white spaces
+        for ($test, $json) {
+            s/([,:]) /$1/eg;
+        }
+
+        my $desc = "roundtrip $test -> " . Dumper($data) . " -> $json";
+        utf8::encode($desc);
+        is $json, $test, $desc;
+
+    }
+
+    while ( my ($encoded, $expected) = each %one_way ) {
+        my $test = "[$encoded]";
+        my $data = eval { JSON::Any->jsonToObj($test) };
+
+        my $desc = "oneway $test -> " . Dumper($data);
+        utf8::encode($desc);
+        is $data->[0], $expected, $desc;
+    }
+}




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