[libhttp-entity-parser-perl] 05/08: Switch from JSON to JSON::MaybeXS
gregor herrmann
gregoa at debian.org
Sun Oct 23 00:23:50 UTC 2016
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to tag 0.18
in repository libhttp-entity-parser-perl.
commit b8123f1b7be2e7e5ceec065550f289af914e3ef2
Author: Karen Etheridge <ether at cpan.org>
Date: Sat Oct 1 21:29:45 2016 -0700
Switch from JSON to JSON::MaybeXS
JSON.pm only supports JSON::PP and JSON::XS; JSON::MaybeXS supports all of
JSON::PP, JSON::XS and Cpanel::JSON::XS, and ensures that the backend(s) are
upgraded to include all the recent utf8 parsing fixes.
---
cpanfile | 2 +-
lib/HTTP/Entity/Parser/JSON.pm | 4 ++--
t/01_content_type/url_encoded.t | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/cpanfile b/cpanfile
index 404bbbd..227ea98 100644
--- a/cpanfile
+++ b/cpanfile
@@ -1,7 +1,7 @@
requires 'perl', '5.008001';
requires 'Stream::Buffered';
requires 'Module::Load';
-requires 'JSON' => '2';
+requires 'JSON::MaybeXS' => '1.003007';
requires 'Encode';
requires 'HTTP::MultiPartParser';
requires 'File::Temp';
diff --git a/lib/HTTP/Entity/Parser/JSON.pm b/lib/HTTP/Entity/Parser/JSON.pm
index 5b17774..2ddd114 100644
--- a/lib/HTTP/Entity/Parser/JSON.pm
+++ b/lib/HTTP/Entity/Parser/JSON.pm
@@ -2,7 +2,7 @@ package HTTP::Entity::Parser::JSON;
use strict;
use warnings;
-use JSON qw//;
+use JSON::MaybeXS qw/decode_json/;
use Encode qw/encode_utf8/;
sub new {
@@ -19,7 +19,7 @@ sub add {
sub finalize {
my $self = shift;
- my $p = JSON::decode_json($self->[0]);
+ my $p = decode_json($self->[0]);
my @params;
if (ref $p eq 'HASH') {
while (my ($k, $v) = each %$p) {
diff --git a/t/01_content_type/url_encoded.t b/t/01_content_type/url_encoded.t
index d756882..8c990d1 100644
--- a/t/01_content_type/url_encoded.t
+++ b/t/01_content_type/url_encoded.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use Test::More;
use HTTP::Entity::Parser::UrlEncoded;
-use JSON;
+use JSON::MaybeXS;
while (<DATA>) {
chomp;
@@ -12,7 +12,7 @@ while (<DATA>) {
my $parser = HTTP::Entity::Parser::UrlEncoded->new();
$parser->add($s);
my ($params, $uploads) = $parser->finalize();
- is JSON::encode_json($params), $t, $s;
+ is encode_json($params), $t, $s;
is_deeply $uploads, [];
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libhttp-entity-parser-perl.git
More information about the Pkg-perl-cvs-commits
mailing list