- patch to allow utf8 to work properly with JSON::XS earlier than version 2

- patch to skip JSON when JSON is earlier than version 2
epel9
Chris Weyl 17 years ago
parent 2f2ce9f476
commit 821524f8df

@ -1,6 +1,6 @@
Name: perl-JSON-Any
Version: 1.16
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A meta-module to make working with JSON easier
License: GPL+ or Artistic
Group: Development/Libraries
@ -10,6 +10,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Patch: with_older_json.patch
# JSON::XS is fastest, so we require it
Requires: perl(JSON::XS)
@ -35,6 +37,7 @@ currently on CPAN.
%prep
%setup -q -n JSON-Any-%{version}
%patch0 -p1
find . -type f -exec chmod -c -x {} +
find t/ -type f -exec perl -pi -e 's|^#!perl|#!/usr/bin/perl|' {} +
@ -69,6 +72,10 @@ rm -rf %{buildroot}
%{_mandir}/man3/*
%changelog
* Sat Mar 22 2008 Chris Weyl <cweyl@alumni.drew.edu> 1.16-3
- patch to allow utf8 to work properly with JSON::XS earlier than version 2
- patch to skip JSON when JSON is earlier than version 2
* Wed Mar 12 2008 Chris Weyl <cweyl@alumni.drew.edu> 1.16-2
- bump

@ -0,0 +1,33 @@
diff -ur JSON-Any-1.16.orig/lib/JSON/Any.pm JSON-Any-1.16/lib/JSON/Any.pm
--- JSON-Any-1.16.orig/lib/JSON/Any.pm 2008-02-13 15:15:46.000000000 -0800
+++ JSON-Any-1.16/lib/JSON/Any.pm 2008-03-22 10:50:12.831848606 -0700
@@ -110,6 +110,8 @@
max_depth
);
+ local $conf->{utf8} = !$conf->{utf8}; # it means the opposite
+
my $obj = $handler->new;
for my $mutator (@params) {
next unless exists $conf->{$mutator};
@@ -199,6 +201,7 @@
foreach my $testmod (@order) {
$testmod = "JSON::$testmod" unless $testmod eq "JSON";
eval "require $testmod";
+ $@ = 'JSON too old' if $testmod eq 'JSON' && "$JSON::VERSION" =~ /^1/;
unless ($@) {
$handler = $testmod;
my $key = _make_key($handler);
diff -ur JSON-Any-1.16.orig/t/04-ENV.t JSON-Any-1.16/t/04-ENV.t
--- JSON-Any-1.16.orig/t/04-ENV.t 2008-01-01 12:05:35.000000000 -0800
+++ JSON-Any-1.16/t/04-ENV.t 2008-03-22 10:36:06.260856865 -0700
@@ -13,7 +13,8 @@
SKIP: {
eval { require JSON; };
- skip "JSON not installed: $@", 1 if $@;
+ skip "JSON unusable or not installed: $@", 1
+ if $@ || $JSON::VERSION =~ /^1/;
$ENV{JSON_ANY_ORDER} = qw(JSON);
JSON::Any->import();
Loading…
Cancel
Save