From: Karen Etheridge <ether@cpan.org>
Date: Sat, 6 Dec 2014 02:18:08 +0000 (-0800)
Subject: the module uses Cpanel::JSON::XS no matter what its version, so we should upgrade... 
X-Git-Tag: v1.003003~3
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=63b80fbc31de4869b252f9ec3a94fd90d4a0e9f2;p=p5sagit%2FJSON-MaybeXS.git

the module uses Cpanel::JSON::XS no matter what its version, so we should upgrade it if it is already installed but old
---

diff --git a/Changes b/Changes
index 226a2d9..b49c56c 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for JSON-MaybeXS
 
+ - ensure an old Cpanel::JSON::XS is upgraded if it is too old, as it will
+   always be used in preference to JSON::XS
+
 1.003002 - 2014-11-16
  - correctly fix boolean interoperability with older Cpanel::JSON::MaybeXS
 
diff --git a/Makefile.PL b/Makefile.PL
index 8bb9ae0..f316895 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -74,8 +74,8 @@ for (qw(configure build test runtime)) {
 # (we also always recommend Cpanel::JSON::XS, just to make sure.)
 $WriteMakefileArgs{PREREQ_PM}{'Cpanel::JSON::XS'} = '2.3310'
     if not parse_args()->{PUREPERL_ONLY}
-        and not eval { require JSON::XS; 1; }
-        and can_xs();
+        and ((eval { require Cpanel::JSON::XS; 1 } and not eval { Cpanel::JSON::XS->VERSION('2.3310'); 1 })
+            or (not eval { require JSON::XS; 1; } and can_xs()));
 
 $WriteMakefileArgs{MIN_PERL_VERSION} = delete $WriteMakefileArgs{PREREQ_PM}{perl} || 0;