From: Karen Etheridge Date: Tue, 28 Jun 2016 21:44:55 +0000 (-0700) Subject: factor out the PUREPERL_ONLY check X-Git-Tag: v1.003006_001~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=db16ce21edcc9061d75a3a27299369d91dfd329c;p=p5sagit%2FJSON-MaybeXS.git factor out the PUREPERL_ONLY check --- diff --git a/Makefile.PL b/Makefile.PL index 9ff02cc..8dbcd06 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -81,25 +81,25 @@ for (qw(configure build test runtime)) { my $args = parse_args(); -# we require Cpanel::JSON::XS, except if JSON::XS is already installed. -# (we also always recommend Cpanel::JSON::XS, just to make sure.) -$WriteMakefileArgs{PREREQ_PM}{'Cpanel::JSON::XS'} = '2.3310' - if not $args->{PUREPERL_ONLY} - 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())); - -# avoid "JSON::XS::Boolean::* redefined" warnings caused by incompatibilities -# between JSON::XS 2.x and 3.0 -- -# if JSON::XS is installed and < 3.0 -# and Cpanel::JSON::XS is (or is about to be) >= 3.0, -# then update JSON::XS to eliminate the incompatibility -$WriteMakefileArgs{PREREQ_PM}{'JSON::XS'} = '3.00' - if not $args->{PUREPERL_ONLY} - and eval { require JSON::XS; 1 } and not eval { JSON::XS->VERSION('3.0'); 1 } - and (eval { require Cpanel::JSON::XS; Cpanel::JSON::XS->VERSION('3.0'); 1 } - # we presume here that if we are installing Cpanel::JSON::XS, we - # are installing the latest version - or exists $WriteMakefileArgs{PREREQ_PM}{'Cpanel::JSON::XS'}); +if (not $args->{PUREPERL_ONLY}) { + # we require Cpanel::JSON::XS, except if JSON::XS is already installed. + # (we also always recommend Cpanel::JSON::XS, just to make sure.) + $WriteMakefileArgs{PREREQ_PM}{'Cpanel::JSON::XS'} = '2.3310' + if (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()); + + # avoid "JSON::XS::Boolean::* redefined" warnings caused by incompatibilities + # between JSON::XS 2.x and 3.0 -- + # if JSON::XS is installed and < 3.0 + # and Cpanel::JSON::XS is (or is about to be) >= 3.0, + # then update JSON::XS to eliminate the incompatibility + $WriteMakefileArgs{PREREQ_PM}{'JSON::XS'} = '3.00' + if eval { require JSON::XS; 1 } and not eval { JSON::XS->VERSION('3.0'); 1 } + and (eval { require Cpanel::JSON::XS; Cpanel::JSON::XS->VERSION('3.0'); 1 } + # we presume here that if we are installing Cpanel::JSON::XS, we + # are installing the latest version + or exists $WriteMakefileArgs{PREREQ_PM}{'Cpanel::JSON::XS'}); +} $WriteMakefileArgs{MIN_PERL_VERSION} = delete $WriteMakefileArgs{PREREQ_PM}{perl} || 0;