r45757 - in /branches/upstream/libjson-any-perl/current: Changes MANIFEST META.yml Makefile.PL README inc/Module/Install/Repository.pm lib/JSON/Any.pm t/02-JSON-XS.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Tue Oct 13 22:49:43 UTC 2009


Author: jawnsy-guest
Date: Tue Oct 13 22:49:38 2009
New Revision: 45757

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

Added:
    branches/upstream/libjson-any-perl/current/inc/Module/Install/Repository.pm
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/README
    branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm
    branches/upstream/libjson-any-perl/current/t/02-JSON-XS.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=45757&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/Changes (original)
+++ branches/upstream/libjson-any-perl/current/Changes Tue Oct 13 22:49:38 2009
@@ -1,4 +1,9 @@
 Revision history for JSON-Any
+
+1.22	2009-10-12
+        * Update JSON::XS tests to deal with inconsistent white space
+          generation between releases (t0m)
+
 1.21    2009-07-03
         * Update JSON::XS boolean support; it provides true/false methods (semifor)
         * Added a workaround for handlers that fail to decode bare true/false values (semifor)
@@ -11,8 +16,8 @@
         * 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)
+1.18    2008-11-12
+        * Removed JSON::PC support as it's been removed from CPAN (perigrin)
 
 1.17    2008-07-05
         * Added documentation indicating that allow_blessed works for most useful
@@ -24,59 +29,59 @@
         * JSON::Any now compatible with both versions of JSON::XS  (Simon Wistow)
         * Document that calling 'use JSON::Any ();' is a bad idea
         * Make JSON.pm required unless a supported JSON package is already installed
-        
-1.15	2008-01-02
-		* Update the config params for JSON and JSON/XS configuration
-		* Update JSON handler to always pass in the -support_by_pp option 
-		  if you don't want support_by_pp then don't use JSON.pm ... 
-		*** THIS VERSION WILL ONLY WORK ON 2.0+ VERSIONS OF THESE MODULES ***
-		
-1.14	2007-12-20
-		* Fix for the new JSON/JSON::XS 2.0
-		*** THIS VERSION WILL ONLY WORK ON 2.0+ VERSIONS OF THESE MODULES ***
 
-1.13	2007-11-06
-		* Fix 10_unicode.t to skip_all if no supported unicode backend is found
-		 (reported by Andreas König)
+1.15    2008-01-02
+        * Update the config params for JSON and JSON/XS configuration
+        * Update JSON handler to always pass in the -support_by_pp option
+          if you don't want support_by_pp then don't use JSON.pm ...
+        *** THIS VERSION WILL ONLY WORK ON 2.0+ VERSIONS OF THESE MODULES ***
 
-1.12	2007-10-22
-		* Fix issue with 05-JSON-Syck.t so we can pass our tests again
+1.14    2007-12-20
+        * Fix for the new JSON/JSON::XS 2.0
+        *** THIS VERSION WILL ONLY WORK ON 2.0+ VERSIONS OF THESE MODULES ***
 
-1.11	17 Oct 2007
-		* fix issue with JSON::Syck when using Object API as reported by Miyagawa
+1.13    2007-11-06
+        * Fix 10_unicode.t to skip_all if no supported unicode backend is found
+         (reported by Andreas Kˆnig)
 
-1.10	12 Oct 2007
-		* fix issues from http://rt.cpan.org/Public/Bug/Display.html?id=29917
+1.12    2007-10-22
+        * Fix issue with 05-JSON-Syck.t so we can pass our tests again
 
-1.09	10 Oct 2007
-		* also test for is_utf8() - nothingmuch
-		* improve unicode test	- nothingmuch
-		* add utf8 support for JSON::{Converter,Parser}	- nothingmuch
-		* Add a test for unicode strings	- nothingmuch
+1.11    17 Oct 2007
+        * fix issue with JSON::Syck when using Object API as reported by Miyagawa
 
-1.08	18 May 2007
-		* Fix Packaging
-		* Fix JSON.pm backend tests 
-		* fix issues with JSON::XS being pedantic about how it's methods/functions are called
-		* added a carp requirement		
+1.10    12 Oct 2007
+        * fix issues from http://rt.cpan.org/Public/Bug/Display.html?id=29917
 
-1.07	???
-		* changed Makefile.PL to Module::Install
-		* helps if I test 04-ENV.t against the code it was designed for
-		* skip all 04-ENV.t until I get it working
-		* fixing tests
-		* change to skip_all based skippage
-		* add example directory
-		* pod updates
+1.09    10 Oct 2007
+        * also test for is_utf8() - nothingmuch
+        * improve unicode test  - nothingmuch
+        * add utf8 support for JSON::{Converter,Parser} - nothingmuch
+        * Add a test for unicode strings    - nothingmuch
 
-1.06	???
-		* cleaned up t/04-ENV.t to not require JSON::XS anymore
-		* fixed split on uninitalized value error
-		* cleaned up JSON-XS tests a bit
-		* added 04-ENV.t to MANIFEST
+1.08    18 May 2007
+        * Fix Packaging
+        * Fix JSON.pm backend tests
+        * fix issues with JSON::XS being pedantic about how it's methods/functions are called
+        * added a carp requirement
 
-... History is Elusive ... 
+1.07    ???
+        * changed Makefile.PL to Module::Install
+        * helps if I test 04-ENV.t against the code it was designed for
+        * skip all 04-ENV.t until I get it working
+        * fixing tests
+        * change to skip_all based skippage
+        * add example directory
+        * pod updates
+
+1.06    ???
+        * cleaned up t/04-ENV.t to not require JSON::XS anymore
+        * fixed split on uninitalized value error
+        * cleaned up JSON-XS tests a bit
+        * added 04-ENV.t to MANIFEST
+
+... History is Elusive ...
 
 1.00    Fri Mar 23 10:24:50 EDT 2007
-		* Initial Release
-		* Currently only supports objToJson and jsonToObj
+        * Initial Release
+        * Currently only supports objToJson and jsonToObj

Modified: branches/upstream/libjson-any-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/MANIFEST?rev=45757&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/MANIFEST (original)
+++ branches/upstream/libjson-any-perl/current/MANIFEST Tue Oct 13 22:49:38 2009
@@ -9,6 +9,7 @@
 inc/Module/Install/Include.pm
 inc/Module/Install/Makefile.pm
 inc/Module/Install/Metadata.pm
+inc/Module/Install/Repository.pm
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
 lib/JSON/Any.pm

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=45757&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/META.yml (original)
+++ branches/upstream/libjson-any-perl/current/META.yml Tue Oct 13 22:49:38 2009
@@ -1,7 +1,7 @@
 ---
 abstract: 'Wrapper Class for the various JSON classes.'
 author:
-  - 'Chris Thompson, C<< <cthom at cpan.org> >>'
+  - 'Chris Thompson C<< cthom at cpan.org >>'
 build_requires:
   ExtUtils::MakeMaker: 6.42
   Test::More: 0.42
@@ -22,4 +22,5 @@
   Carp: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: 1.21
+  repository: git://github.com/perigrin/json-any.git
+version: 1.22

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=45757&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/Makefile.PL (original)
+++ branches/upstream/libjson-any-perl/current/Makefile.PL Tue Oct 13 22:49:38 2009
@@ -48,6 +48,11 @@
     use_standard_tests;
 }
 
+if ($Module::Install::AUTHOR) {
+    system("pod2text lib/JSON/Any.pm > README")
+        and die;
+}
+
 auto_set_repository;
 auto_manifest;
 auto_install;

Modified: branches/upstream/libjson-any-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/README?rev=45757&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/README (original)
+++ branches/upstream/libjson-any-perl/current/README Tue Oct 13 22:49:38 2009
@@ -1,72 +1,155 @@
 NAME
-    JSON::Any - Wrapper Class for the myriad JSON classes.
+    JSON::Any - Wrapper Class for the various JSON classes.
 
 VERSION
-    Version 1.00
+    Version 1.22
 
 SYNOPSIS
     This module will provide a coherent API to bring together the various
-    JSON modules currently on CPAN.
+    JSON modules currently on CPAN. This module will allow you to code to
+    any JSON API and have it work regardless of which JSON module is
+    actually installed.
 
-        use JSON::Any;
+            use JSON::Any;
 
             my $j = JSON::Any->new;
 
             $json = $j->objToJson({foo=>'bar', baz=>'quux'});
+            $obj = $j->jsonToObj($json);
 
-            $obj = $j->jsonToObj($json);
+    or
+
+            $json = $j->encode({foo=>'bar', baz=>'quux'});
+            $obj = $j->decode($json);
+
+    or
+
+            $json = $j->Dump({foo=>'bar', baz=>'quux'});
+            $obj = $j->Load($json);
+
+    or
+
+            $json = $j->to_json({foo=>'bar', baz=>'quux'});
+            $obj = $j->from_json($json);
 
     or without creating an object:
 
             $json = JSON::Any->objToJson({foo=>'bar', baz=>'quux'});
-
             $obj = JSON::Any->jsonToObj($json);
-
-    JSON::Any currently only implements converting back and forth between
-    JSON and hashrefs. There is considerably more functionality in many of
-    the JSON modules. Ability to access these will be provided in subsequent
-    versions of JSON::Any.
 
     On load, JSON::Any will find a valid JSON module in your @INC by looking
     for them in this order:
 
             JSON::XS 
             JSON 
-            JSON::DWIW 
-            JSON::Syck
+            JSON::DWIW
 
     And loading the first one it finds.
 
     You may change the order by specifying it on the "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:
 
             use JSON::Any qw(DWIW XS JSON);
 
     This will check in that order, and will never attempt to load
-    JSON::Syck.
+    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 starting with JSON::Any
+    1.19. In deference to a bug request starting with JSON 1.20 JSON::Syck
+    and other deprecated modules will still be installed, but only as a last
+    resort and will now include a warning.
+
+        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
+
+        use JSON::Any ();
+
+    It will skip the JSON package detection routines and will die loudly
+    that it couldn't find a package.
 
 FUNCTIONS
     "new"
-    There are currently no arguments to "new"
+        Will take any of the parameters for the underlying system and pass
+        them through. However these values don't map between JSON modules,
+        so, from a portability standpoint this is really only helpful for
+        those paramters that happen to have the same name. This will be
+        addressed in a future release.
+
+        The one parameter that is universally supported (to the extent that
+        is supported by the underlying JSON modules) is "utf8". When this
+        parameter is enabled all resulting JSON will be marked as unicode,
+        and all unicode strings in the input data structure will be
+        preserved as such.
+
+        Also note that the "allow_blessed" parameter is recognised by all
+        the modules that throw exceptions when a blessed reference is given
+        them meaning that setting it to true works for all modules. Of
+        course, that means that you cannot set it to false intentionally in
+        order to always get such exceptions.
+
+        The actual output will vary, for example JSON will encode and decode
+        unicode chars (the resulting JSON is not unicode) wheras JSON::XS
+        will emit unicode JSON.
 
     "handlerType"
-    Takes no arguments, returns a string indicating which JSON Module is in
-    use.
+        Takes no arguments, returns a string indicating which JSON Module is
+        in use.
+
+    "handler"
+        Takes no arguments, if called on an object returns the internal
+        JSON::* object in use. Otherwise returns the JSON::* package we are
+        using for class methods.
+
+    "true"
+        Takes no arguments, returns the special value that the internal JSON
+        object uses to map to a JSON "true" boolean.
+
+    "false"
+        Takes no arguments, returns the special value that the internal JSON
+        object uses to map to a JSON "false" boolean.
 
     "objToJson"
-    Takes a single argument, a hashref to be converted into JSON. It returns
-    the JSON text in a scalar.
+        Takes a single argument, a hashref to be converted into JSON. It
+        returns the JSON text in a scalar.
+
+    "to_json"
+    "Dump"
+    "encode"
+        Aliases for objToJson, can be used interchangeably, regardless of
+        the underlying JSON module.
 
     "jsonToObj"
-    Takes a single argument, a string of JSON text to be converted back into
-    a hashref.
+        Takes a single argument, a string of JSON text to be converted back
+        into a hashref.
 
-AUTHOR
-    Chris Thompson, "<cthom at cpan.org>"
+    "from_json"
+    "Load"
+    "decode"
+        Aliases for jsonToObj, can be used interchangeably, regardless of
+        the underlying JSON module.
+
+AUTHORS
+    Chris Thompson "cthom at cpan.org"
+
+    Chris Prather "chris at prather.org"
+
+    Robin Berjon "robin at berjon.com"
+
+    Marc Mims "marc at questright.com"
+
+    Tomas Doran "bobtfish at bobtfish.net"
 
 BUGS
     Please report any bugs or feature requests to "bug-json-any at
@@ -80,11 +163,16 @@
     that there were now six separate JSON perl modules with different
     interfaces.
 
-    In the spirit of Class::Any, I have created JSON::Any with the
-    considerable help of Chris 'Perigrin' Prather, and Matt 'mst' Trout.
+    In the spirit of Class::Any, JSON::Any was created with the considerable
+    help of Matt 'mst' Trout.
+
+    Simon Wistow graciously supplied a patch for backwards compat with
+    JSON::XS versions previous to 2.01
+
+    San Dimas High School Football Rules!
 
 COPYRIGHT & LICENSE
-    Copyright 2007 Chris Thompson, all 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.

Added: branches/upstream/libjson-any-perl/current/inc/Module/Install/Repository.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/inc/Module/Install/Repository.pm?rev=45757&op=file
==============================================================================
--- branches/upstream/libjson-any-perl/current/inc/Module/Install/Repository.pm (added)
+++ branches/upstream/libjson-any-perl/current/inc/Module/Install/Repository.pm Tue Oct 13 22:49:38 2009
@@ -1,0 +1,88 @@
+#line 1
+package Module::Install::Repository;
+
+use strict;
+use 5.005;
+use vars qw($VERSION);
+$VERSION = '0.05';
+
+use base qw(Module::Install::Base);
+
+sub _execute {
+    my ($command) = @_;
+    `$command`;
+}
+
+sub auto_set_repository {
+    my $self = shift;
+
+    return unless $Module::Install::AUTHOR;
+
+    my $repo = _find_repo(\&_execute);
+    if ($repo) {
+        $self->repository($repo);
+    } else {
+        warn "Cannot determine repository URL\n";
+    }
+}
+
+sub _find_repo {
+    my ($execute) = @_;
+
+    if (-e ".git") {
+        # TODO support remote besides 'origin'?
+        if ($execute->('git remote show -n origin') =~ /URL: (.*)$/m) {
+            # XXX Make it public clone URL, but this only works with github
+            my $git_url = $1;
+            $git_url =~ s![\w\-]+\@([^:]+):!git://$1/!;
+            return $git_url;
+        } elsif ($execute->('git svn info') =~ /URL: (.*)$/m) {
+            return $1;
+        }
+    } elsif (-e ".svn") {
+        if (`svn info` =~ /URL: (.*)$/m) {
+            return $1;
+        }
+    } elsif (-e "_darcs") {
+        # defaultrepo is better, but that is more likely to be ssh, not http
+        if (my $query_repo = `darcs query repo`) {
+            if ($query_repo =~ m!Default Remote: (http://.+)!) {
+                return $1;
+            }
+        }
+
+        open my $handle, '<', '_darcs/prefs/repos' or return;
+        while (<$handle>) {
+            chomp;
+            return $_ if m!^http://!;
+        }
+    } elsif (-e ".hg") {
+        if ($execute->('hg paths') =~ /default = (.*)$/m) {
+            my $mercurial_url = $1;
+            $mercurial_url =~ s!^ssh://hg\@(bitbucket\.org/)!https://$1!;
+            return $mercurial_url;
+        }
+    } elsif (-e "$ENV{HOME}/.svk") {
+        # Is there an explicit way to check if it's an svk checkout?
+        my $svk_info = `svk info` or return;
+        SVK_INFO: {
+            if ($svk_info =~ /Mirrored From: (.*), Rev\./) {
+                return $1;
+            }
+
+            if ($svk_info =~ m!Merged From: (/mirror/.*), Rev\.!) {
+                $svk_info = `svk info /$1` or return;
+                redo SVK_INFO;
+            }
+        }
+
+        return;
+    }
+}
+
+1;
+__END__
+
+=encoding utf-8
+
+#line 128

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=45757&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm (original)
+++ branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm Tue Oct 13 22:49:38 2009
@@ -10,11 +10,11 @@
 
 =head1 VERSION
 
-Version 1.21
-
-=cut
-
-our $VERSION = '1.21';
+Version 1.22
+
+=cut
+
+our $VERSION = '1.22';
 
 our $UTF8;
 
@@ -552,12 +552,17 @@
 __END__
 
 
-=head1 AUTHOR
-
-Chris Thompson, C<< <cthom at cpan.org> >>
-Chris Prather, C<< <chris at prather.org> >>
-Robin Berjon, C<< robin at berjon.com >>
-Marc Mims C<<marc at questright.com>>
+=head1 AUTHORS
+
+Chris Thompson C<< cthom at cpan.org >>
+
+Chris Prather C<< chris at prather.org >>
+
+Robin Berjon C<< robin at berjon.com >>
+
+Marc Mims C<< marc at questright.com >>
+
+Tomas Doran C<< bobtfish at bobtfish.net >>
 
 =head1 BUGS
 

Modified: branches/upstream/libjson-any-perl/current/t/02-JSON-XS.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libjson-any-perl/current/t/02-JSON-XS.t?rev=45757&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/t/02-JSON-XS.t (original)
+++ branches/upstream/libjson-any-perl/current/t/02-JSON-XS.t Tue Oct 13 22:49:38 2009
@@ -45,7 +45,7 @@
         pretty       => 1
     )
 );
-is( $json->encode( chr 0x10402 ), '"\ud801\udc02"' );
+like( $json->encode( chr 0x10402 ), qr/"\\ud801\\udc02"\n?/ );
 ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => 1 ) );
 
 is( $json->encode("ü"), qq["\xc3\xbc\"] );




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