Hello community, here is the log from the commit of package perl-JSON for openSUSE:Factory checked in at 2013-06-13 17:42:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-JSON (Old) and /work/SRC/openSUSE:Factory/.perl-JSON.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-JSON" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-JSON/perl-JSON.changes 2011-11-21 12:41:56.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-JSON.new/perl-JSON.changes 2013-06-13 17:42:45.000000000 +0200 @@ -1,0 +2,29 @@ +Mon Jun 10 10:54:05 UTC 2013 - [email protected] + +- updated to 2.59 + - PUREPERL_ONLY support was not supported... + and finally remove all PP options from Makefile.PL. + - recommend JSON::XS instead of conditionally requiring it + patched by miyagaw + ( for example, $ cpanm --with-recommends JSON) + - Hide more packages from PAUSE (and other stuff) + patched by miyagawa + + - support PUREPERL_ONLY install option. (rt#84876) + (PERL_ONLY and NO_XS are not yet removed) + - stop installing JSON::XS automatically on Perl 5.18 + - t/x17_strage_overload.t didn't work correctly. + - fixed t/x17_strage_overload.t (rt#84451 by Ricardo Signes) + - update JSON::BackportPP version + + - fixed t/19_incr.t on perl >= 5.17.10 (wyant, rt#84154) + pathced by mbeijen and modified with demerphq's patch + - Fixed some spelling (by briandfoy) + - fixed sppeling (by Perlover) + - enhanced documents (Thanks to Justin Hunter and Olof Johansson) + - changed backend module loading for overloaded object behavior + (reported by tokuhirom) + +- remove upstreamed fix_provides.diff + +------------------------------------------------------------------- Old: ---- JSON-2.53.tar.gz New: ---- JSON-2.59.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-JSON.spec ++++++ --- /var/tmp/diff_new_pack.tVSh02/_old 2013-06-13 17:42:46.000000000 +0200 +++ /var/tmp/diff_new_pack.tVSh02/_new 2013-06-13 17:42:46.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-JSON # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,28 +16,27 @@ # - Name: perl-JSON -Version: 2.53 -Release: 4 -License: GPL-1.0+ or Artistic-1.0 +Version: 2.59 +Release: 0 %define cpan_name JSON Summary: JSON (JavaScript Object Notation) encoder/decoder -Url: http://search.cpan.org/dist/JSON/ +License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl -Source: http://www.cpan.org/authors/id/M/MA/MAKAMAKA/JSON-%{version}.tar.gz -Patch0: fix_provides.diff +Url: http://search.cpan.org/dist/JSON/ +Source: http://www.cpan.org/authors/id/M/MA/MAKAMAKA/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros +Recommends: perl(JSON::XS) >= 2.34 %{perl_requires} %description ************************** CAUTION ******************************** * This is 'JSON module version 2' and there are many differences * * to version 1.xx * - * Please check your applications useing old version. * + * Please check your applications using old version. * * See to 'INCOMPATIBLE CHANGES TO OLD VERSION' * ******************************************************************* @@ -68,7 +67,6 @@ %prep %setup -q -n %{cpan_name}-%{version} -%patch0 -p1 %build %{__perl} Makefile.PL INSTALLDIRS=vendor @@ -82,11 +80,8 @@ %perl_process_packlist %perl_gen_filelist -%clean -%{__rm} -rf %{buildroot} - %files -f %{name}.files -%defattr(644,root,root,755) +%defattr(-,root,root,755) %doc Changes README %changelog ++++++ JSON-2.53.tar.gz -> JSON-2.59.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/Changes new/JSON-2.59/Changes --- old/JSON-2.53/Changes 2011-05-22 09:13:52.000000000 +0200 +++ new/JSON-2.59/Changes 2013-06-05 08:04:55.000000000 +0200 @@ -2,7 +2,7 @@ ## JSON version 2.xx ##################################################### -In this version, JSON was totally rewritten. +From version 1.xx to 2.xx, JSON was totally rewritten. * JSON becomes a wrapper to JSON::XS or JSON::PP! * objToJson() and jsonToObj() are obsoleted! @@ -13,14 +13,37 @@ ########################################################################## --------------------------------------------------------------------------- -JSON::PP was inculded in JSON distribution (CPAN module). -It comes to be a perl core module in Perl 5.14. -And JSON::PP well be split away it. - -JSON distribution will inculde yet another JSON::PP modules. -They are JSNO::backportPP. So JSON.pm should work as it did at all! --------------------------------------------------------------------------- +2.59 Wed Jun 5 14:35:54 2013 + - PUREPERL_ONLY support was not supported... + and finally remove all PP options from Makefile.PL. + - recommend JSON::XS instead of conditionally requiring it + patched by miyagaw + ( for example, $ cpanm --with-recommends JSON) + - Hide more packages from PAUSE (and other stuff) + patched by miyagawa + +2.58 Thu May 23 09:04:37 2013 + - support PUREPERL_ONLY install option. (rt#84876) + (PERL_ONLY and NO_XS are not yet removed) + - stop installing JSON::XS automatically on Perl 5.18 + +2.57 + - t/x17_strage_overload.t didn't work correctly. + +2.56 Sat Apr 6 09:58:32 2013 + - fixed t/x17_strage_overload.t (rt#84451 by Ricardo Signes) + +2.55 + - update JSON::BackportPP version + +2.54 Fri Apr 5 16:15:08 2013 + - fixed t/19_incr.t on perl >= 5.17.10 (wyant, rt#84154) + pathced by mbeijen and modified with demerphq's patch + - Fixed some spelling (by briandfoy) + - fixed sppeling (by Perlover) + - enhanced documents (Thanks to Justin Hunter and Olof Johansson) + - changed backend module loading for overloaded object behavior + (reported by tokuhirom) 2.53 Sun May 22 16:11:05 2011 - made Makefile.PL skipping a installing XS question diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/MANIFEST new/JSON-2.59/MANIFEST --- old/JSON-2.53/MANIFEST 2011-05-22 08:10:30.000000000 +0200 +++ new/JSON-2.59/MANIFEST 2013-06-05 08:33:14.000000000 +0200 @@ -56,6 +56,7 @@ t/x02_error.t t/x12_blessed.t t/x16_tied.t +t/x17_strange_overload.t t/xe01_property.t t/xe02_bool.t t/xe03_bool2.t @@ -67,3 +68,4 @@ t/xe12_boolean.t t/xe19_xs_and_suportbypp.t t/xe20_croak_message.t +META.json Module JSON meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/META.json new/JSON-2.59/META.json --- old/JSON-2.53/META.json 1970-01-01 01:00:00.000000000 +0100 +++ new/JSON-2.59/META.json 2013-06-05 08:33:14.000000000 +0200 @@ -0,0 +1,49 @@ +{ + "abstract" : "JSON (JavaScript Object Notation) encoder/decoder", + "author" : [ + "Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>" + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.130880", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "JSON", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "prereqs" : { + "build" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "runtime" : { + "recommends" : { + "JSON::XS" : "2.34" + }, + "requires" : { + "Test::More" : "0" + } + } + }, + "release_status" : "stable", + "resources" : { + "repository" : { + "url" : "https://github.com/makamaka/JSON" + } + }, + "version" : "2.59" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/META.yml new/JSON-2.59/META.yml --- old/JSON-2.53/META.yml 2011-05-22 09:18:22.000000000 +0200 +++ new/JSON-2.59/META.yml 2013-06-05 08:33:14.000000000 +0200 @@ -1,24 +1,26 @@ ---- #YAML:1.0 -name: JSON -version: 2.53 -abstract: JSON (JavaScript Object Notation) encoder/decoder +--- +abstract: 'JSON (JavaScript Object Notation) encoder/decoder' author: - - Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt> -license: perl -distribution_type: module -configure_requires: - ExtUtils::MakeMaker: 0 + - 'Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>' build_requires: - ExtUtils::MakeMaker: 0 + ExtUtils::MakeMaker: 0 +configure_requires: + ExtUtils::MakeMaker: 0 +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.130880' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: JSON +no_index: + directory: + - t + - inc +recommends: + JSON::XS: 2.34 requires: - Test::More: 0 + Test::More: 0 resources: - repository: http://github.com/makamaka/JSON -no_index: - directory: - - t - - inc -generated_by: ExtUtils::MakeMaker version 6.56 -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + repository: https://github.com/makamaka/JSON +version: 2.59 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/Makefile.PL new/JSON-2.59/Makefile.PL --- old/JSON-2.53/Makefile.PL 2011-05-22 09:06:07.000000000 +0200 +++ new/JSON-2.59/Makefile.PL 2013-06-05 07:50:29.000000000 +0200 @@ -21,31 +21,8 @@ my $version = JSON->VERSION; -my $req_xs_ver = JSON->require_xs_version; -my $has_xs = 0; -my $xs_ver_is_ok; my $message; -my $pp_only = $ENV{ PERL_ONLY } || $ENV{ NO_XS }; -eval q| require JSON::XS |; - -$has_xs = 1 unless ($@); - - -if ($has_xs) { - my $xs_version = JSON::XS->VERSION; - if ($xs_version >= $req_xs_ver) { - $message = "You have JSON::XS (v.$xs_version), so JSON can work very fast!!"; - $xs_ver_is_ok++; - } - else { - $message = "Your JSON::XS version is $xs_version, but if you install v.$req_xs_ver,\n" - . "JSON will work faster."; - } -} -else { - $message = "If you install JSON::XS v.$req_xs_ver, it makes JSON faster."; -} print <<EOF; Welcome to JSON (v.$version) @@ -62,25 +39,12 @@ EOF -my @prereq_pm; - -if ( not $pp_only and can_auto_xs_install() and not $xs_ver_is_ok ) { - - my $prompt = prompt("Do you want to install JSON::XS?(Y/n)", 'Y'); - - if ( $prompt =~ /^[yY]/ ) { - @prereq_pm = ( 'JSON::XS' => $req_xs_ver ); - } - -} - WriteMakefile( 'NAME' => 'JSON', 'VERSION_FROM' => 'lib/JSON.pm', # finds $VERSION 'PREREQ_PM' => { 'Test::More' => 0, - @prereq_pm, }, ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/JSON.pm', # retrieve abstract from module @@ -90,7 +54,10 @@ ( $ExtUtils::MakeMaker::VERSION >= 6.46 ? ( 'META_MERGE' => { resources => { - repository => 'http://github.com/makamaka/JSON', + repository => 'https://github.com/makamaka/JSON', + }, + recommends => { + 'JSON::XS' => JSON->require_xs_version, }, } ) : () ), @@ -108,36 +75,3 @@ close(IN); rename("Makefile.tmp" => "Makefile"); } - - - - -sub can_auto_xs_install { - return 0 if $] < 5.008002; # JSON::XS requires - return 0 unless ( $ENV{PERL5_CPAN_IS_RUNNING} or $ENV{PERL5_CPANM_IS_RUNNING} ); # not cpan/cpanm running - return can_cc(); -} - - -# copied from http://cpansearch.perl.org/src/GBARR/Scalar-List-Utils-1.23/Makefile.PL - -use Config; - - -sub can_cc { - - require File::Spec; - - foreach my $cmd (split(/ /, $Config::Config{cc})) { - my $_cmd = $cmd; - - return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); - - for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { - my $abs = File::Spec->catfile($dir, $_[1]); - return $abs if (-x $abs or $abs = MM->maybe_command($abs)); - } - } - - return; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/README new/JSON-2.59/README --- old/JSON-2.53/README 2011-05-22 09:14:17.000000000 +0200 +++ new/JSON-2.59/README 2013-06-05 07:50:29.000000000 +0200 @@ -1,14 +1,17 @@ -JSON version 2.53 +JSON version 2.58 ================= -JSON::PP was inculded in JSON distribution (CPAN module). -It comes to be a perl core module in Perl 5.14. -And JSON::PP well be split away it. +"JSON::PP" was earlier included in the "JSON" distribution, +but has since Perl 5.14 been a core module. For this reason, +"JSON::PP" was removed from the "JSON" distribution and can +now be found also in the Perl5 repository at -This developer-versoin is for the preparation. + http://perl5.git.perl.org/perl.git - * JSON distribution will inculde yet another JSON::PP modules. - They are JSNO::backportPP. So JSON.pm should work as it did at all! +(The newest "JSON::PP" version still exists in CPAN.) + +Instead, the "JSON" distribution will include "JSON::backportPP" +for backwards computability. JSON.pm should thus work as it did before. ================= @@ -21,6 +24,11 @@ make test make install +if you use cpanm, can install JSON::XS at once. + + cpanm --with-recommends JSON + + NAME JSON - JSON (JavaScript Object Notation) encoder/decoder @@ -56,22 +64,28 @@ # recommend to use (en|de)code_json. VERSION - 2.53 + 2.58 This version is compatible with JSON::XS 2.27 and later. NOTE - JSON::PP was inculded in "JSON" distribution. It comes to be a perl core - module in Perl 5.14. And JSON::PP will be split away it. + JSON::PP was earlier included in the "JSON" distribution, but has since + Perl 5.14 been a core module. For this reason, JSON::PP was removed from + the JSON distribution and can now be found also in the Perl5 repository + at - "JSON" distribution will inculde yet another JSON::PP modules. They are - JSNO::backportPP and so on. JSON.pm should work as it did at all. + * <http://perl5.git.perl.org/perl.git> + + (The newest JSON::PP version still exists in CPAN.) + + Instead, the "JSON" distribution will include JSON::backportPP for + backwards computability. JSON.pm should thus work as it did before. DESCRIPTION ************************** CAUTION ******************************** * This is 'JSON module version 2' and there are many differences * * to version 1.xx * - * Please check your applications useing old version. * + * Please check your applications using old version. * * See to 'INCOMPATIBLE CHANGES TO OLD VERSION' * ******************************************************************* @@ -111,7 +125,7 @@ Perl version 5.6. JSON::XS requires Perl 5.8.2 (but works correctly in 5.8.8 or - later), so in older versions "JSON" sholud call JSON::PP as the + later), so in older versions "JSON" should call JSON::PP as the backend which can be used since Perl 5.005. With Perl 5.8.x JSON::PP works, but from 5.8.0 to 5.8.2, because of @@ -143,7 +157,7 @@ This module returns a JSON::XS object itself if available. Compared to other JSON modules and other serialisers such as Storable, - JSON::XS usually compares favourably in terms of speed, too. + JSON::XS usually compares favorably in terms of speed, too. If not available, "JSON" returns a JSON::PP object instead of JSON::XS and it is very slow as pure-Perl. @@ -260,7 +274,7 @@ to Perl. HOW DO I DECODE A DATA FROM OUTER AND ENCODE TO OUTER - This section supposes that your perl vresion is 5.8 or later. + This section supposes that your perl version is 5.8 or later. If you know a JSON text from an outer world - a network, a file content, and so on, is encoded in UTF-8, you should use "decode_json" or "JSON" @@ -445,10 +459,10 @@ If $enable is true (or missing), then the "encode" method will use a multiline format as output, putting every array member or object/hash - key-value pair into its own line, identing them properly. + key-value pair into its own line, identifying them properly. If $enable is false, no newlines or indenting will be produced, and the - resulting JSON text is guarenteed not to contain any "newlines". + resulting JSON text is guaranteed not to contain any "newlines". This setting has no effect when decoding JSON texts. @@ -773,7 +787,7 @@ With JSON::PP as the backend, when a large value (100 or more) was set and it de/encodes a deep nested object/text, it may raise a warning - 'Deep recursion on subroutin' at the perl runtime phase. + 'Deep recursion on subroutine' at the perl runtime phase. See "SECURITY CONSIDERATIONS" in JSON::XS for more info on why this is useful. @@ -850,7 +864,7 @@ $json = $json->property($property_name => $boolean); - With no argumnt, it returns all the above properties as a hash + With no argument, it returns all the above properties as a hash reference. $flag_hashref = $json->property(); @@ -869,7 +883,7 @@ The backend module will only attempt to parse the JSON text once it is sure it has enough text to get a decisive result, using a very simple but truly incremental parser. This means that it sometimes won't stop as - early as the full parser, for example, it doesn't detect parenthese + early as the full parser, for example, it doesn't detect parenthesis mismatches. The only thing it guarantees is that it starts decoding as soon as a syntactically valid JSON text has been seen. This means you need to set resource limits (e.g. "max_size") to ensure the parser will @@ -899,7 +913,7 @@ exactly *one* JSON object. If that is successful, it will return this object, otherwise it will return "undef". If there is a parse error, this method will croak just as "decode" would do (one can then use - "incr_skip" to skip the errornous part). This is the most common way of + "incr_skip" to skip the erroneous part). This is the most common way of using the method. And finally, in list context, it will try to extract as many objects @@ -954,7 +968,7 @@ This completely resets the incremental parser, that is, after this call, it will be as if the parser had never parsed anything. - This is useful if you want ot repeatedly parse JSON objects and want to + This is useful if you want to repeatedly parse JSON objects and want to ignore any trailing data, which means you have to reset the parser after each successful decode. @@ -965,7 +979,7 @@ JSON::PP (i.e. the created object is a JSON::PP object), available. See to "JSON::PP OWN METHODS" in JSON::PP in detail. - If you use "JSON" with additonal "-support_by_pp", some methods are + If you use "JSON" with additional "-support_by_pp", some methods are available even with JSON::XS. See to "USE PP FEATURES EVEN THOUGH XS BACKEND". @@ -973,7 +987,7 @@ use JSON -support_by_pp; - my $json = new JSON; + my $json = JSON->new; $json->allow_nonref->escape_slash->encode("/"); # functional interfaces too. @@ -1017,7 +1031,7 @@ integer Perl cannot handle as integer into a Math::BigInt object and convert a floating number (any) into a Math::BigFloat. - On the contary, "encode" converts "Math::BigInt" objects and + On the contrary, "encode" converts "Math::BigInt" objects and "Math::BigFloat" objects into JSON numbers with "allow_blessed" enable. $json->allow_nonref->allow_blessed->allow_bignum; @@ -1025,7 +1039,7 @@ print $json->encode($bigfloat); # => 2.000000000000000000000000001 - See to MAPPING aboout the conversion of JSON number. + See to MAPPING about the conversion of JSON number. loose $json = $json->loose([$enable]) @@ -1109,7 +1123,7 @@ as a numeric (floating point) value if that is possible without loss of precision. Otherwise it will preserve the number as a string value (in which case you lose roundtripping ability, as the JSON - number will be re-encoded toa JSON string). + number will be re-encoded to a JSON string). Numbers containing a fractional or exponential part will always be represented as numeric (floating point) values, possibly at a loss @@ -1120,7 +1134,7 @@ Note that precision is not accuracy - binary floating point values cannot represent most decimal fractions exactly, and when converting from and to floating point, "JSON" only guarantees precision up to - but not including the leats significant bit. + but not including the least significant bit. If the backend is JSON::PP and "allow_bignum" is enable, the big integers and the numeric can be optionally converted into @@ -1129,7 +1143,7 @@ true, false These JSON atoms become "JSON::true" and "JSON::false", respectively. They are overloaded to act almost exactly like the - numbers 1 and 0. You can check wether a scalar is a JSON boolean by + numbers 1 and 0. You can check whether a scalar is a JSON boolean by using the "JSON::is_bool" function. If "JSON::true" and "JSON::false" are used as strings or compared as @@ -1150,7 +1164,7 @@ null A JSON null atom becomes "undef" in Perl. - "JSON::null" returns "unddef". + "JSON::null" returns "undef". PERL -> JSON The mapping from Perl to JSON is slightly more difficult, as Perl is a @@ -1163,7 +1177,7 @@ encoded in a pseudo-random order that can change between runs of the same program but stays generally the same within a single run of a program. "JSON" optionally sort the hash keys (determined by the - *canonical* flag), so the same datastructure will serialise to the + *canonical* flag), so the same data structure will serialise to the same JSON text (given same settings and version of JSON::XS), but this incurs a runtime overhead and is only rarely useful, e.g. when you want to compare some JSON text against another for equality. @@ -1234,7 +1248,7 @@ my $x = "3"; # some variable containing a string $x += 0; # numify it, ensuring it will be dumped as a number - $x *= 1; # same thing, the choise is yours. + $x *= 1; # same thing, the choice is yours. You can not currently force the type in other, less obscure, ways. @@ -1262,7 +1276,7 @@ or later. The "JSON" constructor method returns an object inherited from the - backend module, and JSON::XS object is a blessed scaler reference while + backend module, and JSON::XS object is a blessed scalar reference while JSON::PP is a blessed hash reference. So, your program should not depend on the backend module, especially @@ -1284,7 +1298,7 @@ $json->is_pp; # 0 or 1 - If you set an enviornment variable "PERL_JSON_BACKEND", The calling + If you set an environment variable "PERL_JSON_BACKEND", the calling action will be changed. PERL_JSON_BACKEND = 0 or PERL_JSON_BACKEND = 'JSON::PP' @@ -1300,7 +1314,7 @@ PERL_JSON_BACKEND = 'JSON::backportPP' Always use JSON::backportPP. JSON::backportPP is JSON::PP back port - module. "JSON" includs JSON::backportPP instead of JSON::PP. + module. "JSON" includes JSON::backportPP instead of JSON::PP. These ideas come from DBI::PurePerl mechanism. @@ -1314,15 +1328,15 @@ USE PP FEATURES EVEN THOUGH XS BACKEND Many methods are available with either JSON::XS or JSON::PP and when the backend module is JSON::XS, if any JSON::PP specific (i.e. JSON::XS - unspported) method is called, it will "warn" and be noop. + unsupported) method is called, it will "warn" and be noop. But If you "use" "JSON" passing the optional string "-support_by_pp", it - makes a part of those unupported methods available. This feature is + makes a part of those unsupported methods available. This feature is achieved by using JSON::PP in "de/encode". BEGIN { $ENV{PERL_JSON_BACKEND} = 2 } # with JSON::XS use JSON -support_by_pp; - my $json = new JSON; + my $json = JSON->new; $json->allow_nonref->escape_slash->encode("/"); At this time, the returned object is a "JSON::Backend::XS::Supportable" @@ -1511,11 +1525,11 @@ Disable. See to MAPPING. $JSON::SelfConvert - This option was deleted. Instead of it, if a givien blessed object + This option was deleted. Instead of it, if a given blessed object has the "TO_JSON" method, "TO_JSON" will be executed with "convert_blessed". - $json->convert_blessed->encode($bleesed_hashref_or_arrayref) + $json->convert_blessed->encode($blessed_hashref_or_arrayref) # if need, call allow_blessed Note that it was "toJson" in old version, but now not "toJson" but @@ -1542,10 +1556,10 @@ JSON::XS was written by Marc Lehmann <schmorp[at]schmorp.de> - The relese of this new version owes to the courtesy of Marc Lehmann. + The release of this new version owes to the courtesy of Marc Lehmann. COPYRIGHT AND LICENSE - Copyright 2005-2011 by Makamaka Hannyaharamitu + Copyright 2005-2013 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/lib/JSON/backportPP/Boolean.pm new/JSON-2.59/lib/JSON/backportPP/Boolean.pm --- old/JSON-2.53/lib/JSON/backportPP/Boolean.pm 2010-12-20 08:41:45.000000000 +0100 +++ new/JSON-2.59/lib/JSON/backportPP/Boolean.pm 2013-04-05 07:24:51.000000000 +0200 @@ -8,8 +8,8 @@ =head1 DESCRIPTION -This module exists only to provide overload resolution for Storable and similar modules. See -L<JSON::PP> for more info about this class. +This module exists only to provide overload resolution for Storable +and similar modules. See L<JSON::PP> for more info about this class. =cut @@ -20,7 +20,8 @@ =head1 AUTHOR -This idea is from L<JSON::XS::Boolean> written by Marc Lehmann <schmorp[at]schmorp.de> +This idea is from L<JSON::XS::Boolean> written by +Marc Lehmann <schmorp[at]schmorp.de> =cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/lib/JSON/backportPP/Compat5005.pm new/JSON-2.59/lib/JSON/backportPP/Compat5005.pm --- old/JSON-2.53/lib/JSON/backportPP/Compat5005.pm 2010-12-20 08:41:45.000000000 +0100 +++ new/JSON-2.59/lib/JSON/backportPP/Compat5005.pm 2013-04-05 07:24:51.000000000 +0200 @@ -122,7 +122,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright 2007-2010 by Makamaka Hannyaharamitu +Copyright 2007-2012 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/lib/JSON/backportPP/Compat5006.pm new/JSON-2.59/lib/JSON/backportPP/Compat5006.pm --- old/JSON-2.53/lib/JSON/backportPP/Compat5006.pm 2010-12-20 08:41:45.000000000 +0100 +++ new/JSON-2.59/lib/JSON/backportPP/Compat5006.pm 2013-04-05 07:24:51.000000000 +0200 @@ -164,7 +164,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright 2007-2009 by Makamaka Hannyaharamitu +Copyright 2007-2012 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/lib/JSON/backportPP.pm new/JSON-2.59/lib/JSON/backportPP.pm --- old/JSON-2.53/lib/JSON/backportPP.pm 2011-05-22 08:00:58.000000000 +0200 +++ new/JSON-2.59/lib/JSON/backportPP.pm 2013-05-23 06:37:21.000000000 +0200 @@ -12,7 +12,8 @@ use B (); #use Devel::Peek; -$JSON::PP::VERSION = '2.27200'; +use vars qw($VERSION); +$VERSION = '2.27202'; @JSON::PP::EXPORT = qw(encode_json decode_json from_json to_json); @@ -618,7 +619,7 @@ my $utf8_len; # utf8 byte length # FLAGS my $utf8; # must be utf8 - my $max_depth; # max nest nubmer of objects and arrays + my $max_depth; # max nest number of objects and arrays my $max_size; my $relaxed; my $cb_object; @@ -1051,7 +1052,7 @@ my $n = ''; my $v; - # According to RFC4627, hex or oct digts are invalid. + # According to RFC4627, hex or oct digits are invalid. if($ch eq '0'){ my $peek = substr($text,$at,1); my $hex = $peek =~ /[xX]/; # 0 or 1 @@ -1286,7 +1287,8 @@ } if ($] >= 5.008 and $] < 5.008003) { # join() in 5.8.0 - 5.8.2 is broken. - package JSON::PP; + package # hide from PAUSE + JSON::PP; require subs; subs->import('join'); eval q| @@ -1341,7 +1343,7 @@ *JSON::PP::reftype = \&Scalar::Util::reftype; *JSON::PP::refaddr = \&Scalar::Util::refaddr; } - else{ # This code is from Sclar::Util. + else{ # This code is from Scalar::Util. # warn $@; eval 'sub UNIVERSAL::a_sub_not_likely_to_be_here { ref($_[0]) }'; *JSON::PP::blessed = sub { @@ -1390,7 +1392,7 @@ } -# shamely copied and modified from JSON::XS code. +# shamelessly copied and modified from JSON::XS code. $JSON::PP::true = do { bless \(my $dummy = 1), "JSON::backportPP::Boolean" }; $JSON::PP::false = do { bless \(my $dummy = 0), "JSON::backportPP::Boolean" }; @@ -1416,8 +1418,8 @@ ############################### -package - JSON::PP::IncrParser; +package # hide from PAUSE + JSON::PP::IncrParser; use strict; @@ -1428,7 +1430,8 @@ use constant INCR_M_C0 => 4; use constant INCR_M_C1 => 5; -$JSON::PP::IncrParser::VERSION = '1.01'; +use vars qw($VERSION); +$VERSION = '1.01'; my $unpack_format = $] < 5.006 ? 'C*' : 'U*'; @@ -1657,23 +1660,26 @@ This module knows how to handle Unicode (depending on Perl version). -See to L<JSON::XS/A FEW NOTES ON UNICODE AND PERL> and L<UNICODE HANDLING ON PERLS>. +See to L<JSON::XS/A FEW NOTES ON UNICODE AND PERL> and +L<UNICODE HANDLING ON PERLS>. =item * round-trip integrity -When you serialise a perl data structure using only data types supported -by JSON and Perl, the deserialised data structure is identical on the Perl -level. (e.g. the string "2.0" doesn't suddenly become "2" just because -it looks like a number). There I<are> minor exceptions to this, read the -MAPPING section below to learn about those. +When you serialise a perl data structure using only data types +supported by JSON and Perl, the deserialised data structure is +identical on the Perl level. (e.g. the string "2.0" doesn't suddenly +become "2" just because it looks like a number). There I<are> minor +exceptions to this, read the MAPPING section below to learn about +those. =item * strict checking of JSON correctness There is no guessing, no generating of illegal JSON texts by default, -and only JSON is accepted as input by default (the latter is a security feature). -But when some options are set, loose chcking features are available. +and only JSON is accepted as input by default (the latter is a +security feature). But when some options are set, loose checking +features are available. =back @@ -1731,7 +1737,7 @@ =head1 HOW DO I DECODE A DATA FROM OUTER AND ENCODE TO OUTER -This section supposes that your perl vresion is 5.8 or later. +This section supposes that your perl version is 5.8 or later. If you know a JSON text from an outer world - a network, a file content, and so on, is encoded in UTF-8, you should use C<decode_json> or C<JSON> module object @@ -1813,7 +1819,7 @@ $json = JSON::PP->new -Rturns a new JSON::PP object that can be used to de/encode JSON +Returns a new JSON::PP object that can be used to de/encode JSON strings. All boolean flags described below are by default I<disabled>. @@ -2021,7 +2027,7 @@ This setting has no effect when decoding JSON texts. -If you want your own sorting routine, you can give a code referece +If you want your own sorting routine, you can give a code reference or a subroutine name to C<sort_by>. See to C<JSON::PP OWN METHODS>. =head2 allow_nonref @@ -2222,7 +2228,7 @@ See L<JSON::XS/SSECURITY CONSIDERATIONS> for more info on why this is useful. When a large value (100 or more) was set and it de/encodes a deep nested object/text, -it may raise a warning 'Deep recursion on subroutin' at the perl runtime phase. +it may raise a warning 'Deep recursion on subroutine' at the perl runtime phase. =head2 max_size @@ -2239,7 +2245,7 @@ If no argument is given, the limit check will be deactivated (same as when C<0> is specified). -See L<JSON::XS/SSECURITY CONSIDERATIONS> for more info on why this is useful. +See L<JSON::XS/SECURITY CONSIDERATIONS> for more info on why this is useful. =head2 encode @@ -2290,7 +2296,7 @@ This module will only attempt to parse the JSON text once it is sure it has enough text to get a decisive result, using a very simple but truly incremental parser. This means that it sometimes won't stop as -early as the full parser, for example, it doesn't detect parenthese +early as the full parser, for example, it doesn't detect parenthesis mismatches. The only thing it guarantees is that it starts decoding as soon as a syntactically valid JSON text has been seen. This means you need to set resource limits (e.g. C<max_size>) to ensure the parser will stop @@ -2321,7 +2327,7 @@ exactly I<one> JSON object. If that is successful, it will return this object, otherwise it will return C<undef>. If there is a parse error, this method will croak just as C<decode> would do (one can then use -C<incr_skip> to skip the errornous part). This is the most common way of +C<incr_skip> to skip the erroneous part). This is the most common way of using the method. And finally, in list context, it will try to extract as many objects @@ -2377,7 +2383,7 @@ This completely resets the incremental parser, that is, after this call, it will be as if the parser had never parsed anything. -This is useful if you want ot repeatedly parse JSON objects and want to +This is useful if you want to repeatedly parse JSON objects and want to ignore any trailing data, which means you have to reset the parser after each successful decode. @@ -2422,7 +2428,7 @@ the big integer Perl cannot handle as integer into a L<Math::BigInt> object and convert a floating number (any) into a L<Math::BigFloat>. -On the contary, C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat> +On the contrary, C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat> objects into JSON numbers with C<allow_blessed> enable. $json->allow_nonref->allow_blessed->allow_bignum; @@ -2430,7 +2436,7 @@ print $json->encode($bigfloat); # => 2.000000000000000000000000001 -See to L<JSON::XS/MAPPING> aboout the normal conversion of JSON number. +See to L<JSON::XS/MAPPING> about the normal conversion of JSON number. =head2 loose @@ -2556,7 +2562,7 @@ a numeric (floating point) value if that is possible without loss of precision. Otherwise it will preserve the number as a string value (in which case you lose roundtripping ability, as the JSON number will be -re-encoded toa JSON string). +re-encoded to a JSON string). Numbers containing a fractional or exponential part will always be represented as numeric (floating point) values, possibly at a loss of @@ -2566,7 +2572,7 @@ Note that precision is not accuracy - binary floating point values cannot represent most decimal fractions exactly, and when converting from and to floating point, C<JSON> only guarantees precision up to but not including -the leats significant bit. +the least significant bit. When C<allow_bignum> is enable, the big integers and the numeric can be optionally converted into L<Math::BigInt> and @@ -2576,7 +2582,7 @@ These JSON atoms become C<JSON::PP::true> and C<JSON::PP::false>, respectively. They are overloaded to act almost exactly like the numbers -C<1> and C<0>. You can check wether a scalar is a JSON boolean by using +C<1> and C<0>. You can check whether a scalar is a JSON boolean by using the C<JSON::is_bool> function. print JSON::PP::true . "\n"; @@ -2594,7 +2600,7 @@ A JSON null atom becomes C<undef> in Perl. -C<JSON::PP::null> returns C<unddef>. +C<JSON::PP::null> returns C<undef>. =back @@ -2614,7 +2620,7 @@ pseudo-random order that can change between runs of the same program but stays generally the same within a single run of a program. C<JSON> optionally sort the hash keys (determined by the I<canonical> flag), so -the same datastructure will serialise to the same JSON text (given same +the same data structure will serialise to the same JSON text (given same settings and version of JSON::XS), but this incurs a runtime overhead and is only rarely useful, e.g. when you want to compare some JSON text against another for equality. @@ -2680,7 +2686,7 @@ my $x = "3"; # some variable containing a string $x += 0; # numify it, ensuring it will be dumped as a number - $x *= 1; # same thing, the choise is yours. + $x *= 1; # same thing, the choice is yours. You can not currently force the type in other, less obscure, ways. @@ -2712,7 +2718,7 @@ $json->allow_nonref->encode(chr hex 3042); $json->allow_nonref->encode(chr hex 12345); -Reuturns C<"\u3042"> and C<"\ud808\udf45"> respectively. +Returns C<"\u3042"> and C<"\ud808\udf45"> respectively. $json->allow_nonref->decode('"\u3042"'); $json->allow_nonref->decode('"\ud808\udf45"'); @@ -2729,7 +2735,7 @@ =head2 Perl 5.005 -Perl 5.005 is a byte sementics world -- all strings are sequences of bytes. +Perl 5.005 is a byte semantics world -- all strings are sequences of bytes. That means the unicode handling is not available. In encoding, @@ -2789,7 +2795,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright 2007-2011 by Makamaka Hannyaharamitu +Copyright 2007-2012 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/lib/JSON.pm new/JSON-2.59/lib/JSON.pm --- old/JSON-2.53/lib/JSON.pm 2011-05-22 09:10:24.000000000 +0200 +++ new/JSON-2.59/lib/JSON.pm 2013-06-05 07:50:29.000000000 +0200 @@ -7,7 +7,7 @@ @JSON::EXPORT = qw(from_json to_json jsonToObj objToJson encode_json decode_json); BEGIN { - $JSON::VERSION = '2.53'; + $JSON::VERSION = '2.59'; $JSON::DEBUG = 0 unless (defined $JSON::DEBUG); $JSON::DEBUG = $ENV{ PERL_JSON_DEBUG } if exists $ENV{ PERL_JSON_DEBUG }; } @@ -16,7 +16,7 @@ my $Module_PP = 'JSON::PP'; my $Module_bp = 'JSON::backportPP'; # included in JSON distribution my $PP_Version = '2.27200'; -my $XS_Version = '2.27'; +my $XS_Version = '2.34'; # XS and PP common methods @@ -142,7 +142,7 @@ ) { Carp::croak "to_json should not be called as a method."; } - my $json = new JSON; + my $json = JSON->new; if (@_ == 2 and ref $_[1] eq 'HASH') { my $opt = $_[1]; @@ -159,7 +159,7 @@ if ( ref($_[0]) eq 'JSON' or $_[0] eq 'JSON' ) { Carp::croak "from_json should not be called as a method."; } - my $json = new JSON; + my $json = JSON->new; if (@_ == 2 and ref $_[1] eq 'HASH') { my $opt = $_[1]; @@ -296,7 +296,7 @@ $_USSING_bpPP++; $backend = $Module_bp; JSON::Boolean::_overrride_overload($backend); - local $^W; # if PP installed but invalid version, backportPP redifines methods. + local $^W; # if PP installed but invalid version, backportPP redefines methods. eval qq| require $Module_bp |; } Carp::croak $@ if $@; @@ -368,6 +368,21 @@ if ($@) { Carp::croak $@; } + if ( exists $INC{'JSON/XS.pm'} and $boolean eq 'JSON::XS::Boolean' ) { + local $^W; + my $true = do { bless \(my $dummy = 1), $boolean }; + my $false = do { bless \(my $dummy = 0), $boolean }; + *JSON::XS::true = sub () { $true }; + *JSON::XS::false = sub () { $false }; + } + elsif ( exists $INC{'JSON/PP.pm'} and $boolean eq 'JSON::PP::Boolean' ) { + local $^W; + my $true = do { bless \(my $dummy = 1), $boolean }; + my $false = do { bless \(my $dummy = 0), $boolean }; + *JSON::PP::true = sub { $true }; + *JSON::PP::false = sub { $false }; + } + return 1; } @@ -456,7 +471,7 @@ my $pkg = 'JSON::Backend::XS::Supportable'; *{JSON::new} = sub { - my $proto = new JSON::XS; $$proto = 0; + my $proto = JSON::XS->new; $$proto = 0; bless $proto, $pkg; }; @@ -518,7 +533,7 @@ JSON::_load_pp( $_INSTALL_ONLY ); my $type = shift; - my $pp = new JSON::PP; + my $pp = JSON::PP->new; my $prop = $_[0]->property; for my $name (keys %$prop) { @@ -541,7 +556,7 @@ return $pp; } -sub _encode { # using with PP encod +sub _encode { # using with PP encode if (${$_[0]}) { _set_for_pp('encode' => @_)->encode($_[1]); } @@ -640,26 +655,36 @@ =head1 VERSION - 2.53 + 2.59 -This version is compatible with JSON::XS B<2.27> and later. +This version is compatible with JSON::XS B<2.34> and later. =head1 NOTE -JSON::PP was inculded in C<JSON> distribution. -It comes to be a perl core module in Perl 5.14. -And L<JSON::PP> will be split away it. +JSON::PP was earlier included in the C<JSON> distribution, but +has since Perl 5.14 been a core module. For this reason, +L<JSON::PP> was removed from the JSON distribution and can now +be found also in the Perl5 repository at + +=over + +=item * L<http://perl5.git.perl.org/perl.git> + +=back + +(The newest JSON::PP version still exists in CPAN.) -C<JSON> distribution will inculde yet another JSON::PP modules. -They are JSNO::backportPP and so on. JSON.pm should work as it did at all. +Instead, the C<JSON> distribution will include JSON::backportPP +for backwards computability. JSON.pm should thus work as it did +before. =head1 DESCRIPTION ************************** CAUTION ******************************** * This is 'JSON module version 2' and there are many differences * * to version 1.xx * - * Please check your applications useing old version. * + * Please check your applications using old version. * * See to 'INCOMPATIBLE CHANGES TO OLD VERSION' * ******************************************************************* @@ -699,7 +724,7 @@ Even though there are limitations, this feature is available since Perl version 5.6. JSON::XS requires Perl 5.8.2 (but works correctly in 5.8.8 or later), so in older versions -C<JSON> sholud call JSON::PP as the backend which can be used since Perl 5.005. +C<JSON> should call JSON::PP as the backend which can be used since Perl 5.005. With Perl 5.8.x JSON::PP works, but from 5.8.0 to 5.8.2, because of a Perl side problem, JSON::PP works slower in the versions. And in 5.005, the Unicode handling is not available. @@ -730,7 +755,7 @@ This module returns a JSON::XS object itself if available. Compared to other JSON modules and other serialisers such as Storable, -JSON::XS usually compares favourably in terms of speed, too. +JSON::XS usually compares favorably in terms of speed, too. If not available, C<JSON> returns a JSON::PP object instead of JSON::XS and it is very slow as pure-Perl. @@ -856,7 +881,7 @@ =head1 HOW DO I DECODE A DATA FROM OUTER AND ENCODE TO OUTER -This section supposes that your perl vresion is 5.8 or later. +This section supposes that your perl version is 5.8 or later. If you know a JSON text from an outer world - a network, a file content, and so on, is encoded in UTF-8, you should use C<decode_json> or C<JSON> module object @@ -938,7 +963,7 @@ =head2 new - $json = new JSON + $json = JSON->new Returns a new C<JSON> object inherited from either JSON::XS or JSON::PP that can be used to de/encode JSON strings. @@ -1041,10 +1066,10 @@ If C<$enable> is true (or missing), then the C<encode> method will use a multiline format as output, putting every array member or object/hash key-value pair -into its own line, identing them properly. +into its own line, identifying them properly. If C<$enable> is false, no newlines or indenting will be produced, and the -resulting JSON text is guarenteed not to contain any C<newlines>. +resulting JSON text is guaranteed not to contain any C<newlines>. This setting has no effect when decoding JSON texts. @@ -1395,7 +1420,7 @@ With JSON::PP as the backend, when a large value (100 or more) was set and it de/encodes a deep nested object/text, it may raise a warning -'Deep recursion on subroutin' at the perl runtime phase. +'Deep recursion on subroutine' at the perl runtime phase. See L<JSON::XS/SECURITY CONSIDERATIONS> for more info on why this is useful. @@ -1474,7 +1499,7 @@ $json = $json->property($property_name => $boolean); -With no argumnt, it returns all the above properties as a hash reference. +With no argument, it returns all the above properties as a hash reference. $flag_hashref = $json->property(); @@ -1492,7 +1517,7 @@ The backend module will only attempt to parse the JSON text once it is sure it has enough text to get a decisive result, using a very simple but truly incremental parser. This means that it sometimes won't stop as -early as the full parser, for example, it doesn't detect parenthese +early as the full parser, for example, it doesn't detect parenthesis mismatches. The only thing it guarantees is that it starts decoding as soon as a syntactically valid JSON text has been seen. This means you need to set resource limits (e.g. C<max_size>) to ensure the parser will stop @@ -1523,7 +1548,7 @@ exactly I<one> JSON object. If that is successful, it will return this object, otherwise it will return C<undef>. If there is a parse error, this method will croak just as C<decode> would do (one can then use -C<incr_skip> to skip the errornous part). This is the most common way of +C<incr_skip> to skip the erroneous part). This is the most common way of using the method. And finally, in list context, it will try to extract as many objects @@ -1579,7 +1604,7 @@ This completely resets the incremental parser, that is, after this call, it will be as if the parser had never parsed anything. -This is useful if you want ot repeatedly parse JSON objects and want to +This is useful if you want to repeatedly parse JSON objects and want to ignore any trailing data, which means you have to reset the parser after each successful decode. @@ -1592,14 +1617,14 @@ with JSON::PP (i.e. the created object is a JSON::PP object), available. See to L<JSON::PP/JSON::PP OWN METHODS> in detail. -If you use C<JSON> with additonal C<-support_by_pp>, some methods +If you use C<JSON> with additional C<-support_by_pp>, some methods are available even with JSON::XS. See to L<USE PP FEATURES EVEN THOUGH XS BACKEND>. BEING { $ENV{PERL_JSON_BACKEND} = 'JSON::XS' } use JSON -support_by_pp; - my $json = new JSON; + my $json = JSON->new; $json->allow_nonref->escape_slash->encode("/"); # functional interfaces too. @@ -1647,7 +1672,7 @@ the big integer Perl cannot handle as integer into a L<Math::BigInt> object and convert a floating number (any) into a L<Math::BigFloat>. -On the contary, C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat> +On the contrary, C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat> objects into JSON numbers with C<allow_blessed> enable. $json->allow_nonref->allow_blessed->allow_bignum; @@ -1655,7 +1680,7 @@ print $json->encode($bigfloat); # => 2.000000000000000000000000001 -See to L<MAPPING> aboout the conversion of JSON number. +See to L<MAPPING> about the conversion of JSON number. =head2 loose @@ -1750,7 +1775,7 @@ a numeric (floating point) value if that is possible without loss of precision. Otherwise it will preserve the number as a string value (in which case you lose roundtripping ability, as the JSON number will be -re-encoded toa JSON string). +re-encoded to a JSON string). Numbers containing a fractional or exponential part will always be represented as numeric (floating point) values, possibly at a loss of @@ -1760,7 +1785,7 @@ Note that precision is not accuracy - binary floating point values cannot represent most decimal fractions exactly, and when converting from and to floating point, C<JSON> only guarantees precision up to but not including -the leats significant bit. +the least significant bit. If the backend is JSON::PP and C<allow_bignum> is enable, the big integers and the numeric can be optionally converted into L<Math::BigInt> and @@ -1770,7 +1795,7 @@ These JSON atoms become C<JSON::true> and C<JSON::false>, respectively. They are overloaded to act almost exactly like the numbers -C<1> and C<0>. You can check wether a scalar is a JSON boolean by using +C<1> and C<0>. You can check whether a scalar is a JSON boolean by using the C<JSON::is_bool> function. If C<JSON::true> and C<JSON::false> are used as strings or compared as strings, @@ -1792,7 +1817,7 @@ A JSON null atom becomes C<undef> in Perl. -C<JSON::null> returns C<unddef>. +C<JSON::null> returns C<undef>. =back @@ -1812,7 +1837,7 @@ pseudo-random order that can change between runs of the same program but stays generally the same within a single run of a program. C<JSON> optionally sort the hash keys (determined by the I<canonical> flag), so -the same datastructure will serialise to the same JSON text (given same +the same data structure will serialise to the same JSON text (given same settings and version of JSON::XS), but this incurs a runtime overhead and is only rarely useful, e.g. when you want to compare some JSON text against another for equality. @@ -1887,7 +1912,7 @@ my $x = "3"; # some variable containing a string $x += 0; # numify it, ensuring it will be dumped as a number - $x *= 1; # same thing, the choise is yours. + $x *= 1; # same thing, the choice is yours. You can not currently force the type in other, less obscure, ways. @@ -1923,7 +1948,7 @@ C<uses> JSON::PP. The required JSON::XS version is I<2.2> or later. The C<JSON> constructor method returns an object inherited from the backend module, -and JSON::XS object is a blessed scaler reference while JSON::PP is a blessed hash +and JSON::XS object is a blessed scalar reference while JSON::PP is a blessed hash reference. So, your program should not depend on the backend module, especially @@ -1945,7 +1970,7 @@ $json->is_pp; # 0 or 1 -If you set an enviornment variable C<PERL_JSON_BACKEND>, The calling action will be changed. +If you set an environment variable C<PERL_JSON_BACKEND>, the calling action will be changed. =over @@ -1966,7 +1991,7 @@ Always use JSON::backportPP. JSON::backportPP is JSON::PP back port module. -C<JSON> includs JSON::backportPP instead of JSON::PP. +C<JSON> includes JSON::backportPP instead of JSON::PP. =back @@ -1982,16 +2007,16 @@ =head1 USE PP FEATURES EVEN THOUGH XS BACKEND Many methods are available with either JSON::XS or JSON::PP and -when the backend module is JSON::XS, if any JSON::PP specific (i.e. JSON::XS unspported) +when the backend module is JSON::XS, if any JSON::PP specific (i.e. JSON::XS unsupported) method is called, it will C<warn> and be noop. But If you C<use> C<JSON> passing the optional string C<-support_by_pp>, -it makes a part of those unupported methods available. +it makes a part of those unsupported methods available. This feature is achieved by using JSON::PP in C<de/encode>. BEGIN { $ENV{PERL_JSON_BACKEND} = 2 } # with JSON::XS use JSON -support_by_pp; - my $json = new JSON; + my $json = JSON->new; $json->allow_nonref->escape_slash->encode("/"); At this time, the returned object is a C<JSON::Backend::XS::Supportable> @@ -2211,10 +2236,10 @@ =item $JSON::SelfConvert This option was deleted. -Instead of it, if a givien blessed object has the C<TO_JSON> method, +Instead of it, if a given blessed object has the C<TO_JSON> method, C<TO_JSON> will be executed with C<convert_blessed>. - $json->convert_blessed->encode($bleesed_hashref_or_arrayref) + $json->convert_blessed->encode($blessed_hashref_or_arrayref) # if need, call allow_blessed Note that it was C<toJson> in old version, but now not C<toJson> but C<TO_JSON>. @@ -2253,12 +2278,12 @@ JSON::XS was written by Marc Lehmann <schmorp[at]schmorp.de> -The relese of this new version owes to the courtesy of Marc Lehmann. +The release of this new version owes to the courtesy of Marc Lehmann. =head1 COPYRIGHT AND LICENSE -Copyright 2005-2011 by Makamaka Hannyaharamitu +Copyright 2005-2013 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/t/19_incr.t new/JSON-2.59/t/19_incr.t --- old/JSON-2.53/t/19_incr.t 2010-12-20 08:41:45.000000000 +0100 +++ new/JSON-2.59/t/19_incr.t 2013-04-05 08:29:06.000000000 +0200 @@ -13,11 +13,13 @@ if ( $] >= 5.006 ) { -eval <<'TEST'; +eval <<'TEST' or die "Failed to eval test code for version $]: $@"; sub splitter { my ($coder, $text) = @_; + $coder->canonical(1) if $] >= 5.017009; + for (0 .. length $text) { my $a = substr $text, 0, $_; my $b = substr $text, $_; @@ -27,7 +29,7 @@ my $data = $coder->incr_parse; ok ($data); - ok ($coder->encode ($data) eq $coder->encode ($coder->decode ($text)), "data"); + is ($coder->encode ($data), $coder->encode ($coder->decode ($text)), "data"); ok ($coder->incr_text =~ /^\s*$/, "tailws"); } } @@ -78,13 +80,12 @@ TEST -print $@; } else { -eval <<'TEST'; +eval <<'TEST' or die "Failed to eval test code for version $]: $@"; my $incr_text; @@ -148,8 +149,6 @@ TEST -print $@; - } # for 5.005 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/t/99_binary.t new/JSON-2.59/t/99_binary.t --- old/JSON-2.53/t/99_binary.t 2010-12-20 08:41:45.000000000 +0100 +++ new/JSON-2.59/t/99_binary.t 2012-05-02 09:48:31.000000000 +0200 @@ -40,7 +40,7 @@ ok ($_[0] eq JSON->new->shrink->decode ($js)->[0]); } -srand 0; # doesn't help too much, but its at leats more deterministic +srand 0; # doesn't help too much, but its at least more deterministic #for (1..768) { for (1..64, 125..129, 255..257, 512, 704, 736, 768) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-2.53/t/x17_strange_overload.t new/JSON-2.59/t/x17_strange_overload.t --- old/JSON-2.53/t/x17_strange_overload.t 1970-01-01 01:00:00.000000000 +0100 +++ new/JSON-2.59/t/x17_strange_overload.t 2013-04-06 08:34:12.000000000 +0200 @@ -0,0 +1,20 @@ +use strict; +use Test::More; +BEGIN { plan tests => 2 }; + +BEGIN { $ENV{PERL_JSON_BACKEND} = 1; } + +SKIP: { + eval q{ + use JSON::XS; + use JSON (); + }; + + skip "can't use JSON::XS.", 2, if $@; + skip "JSON::XS version < " . JSON->require_xs_version, 2 + if JSON::XS->VERSION < JSON->require_xs_version; + + is("" . JSON::XS::true(), 'true'); + is("" . JSON::true(), 'true'); +} + -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
