Show quoted text> Unfortunately, the toolchain is not able to do that (attempt to
> install X, but if X fails, fall back to Y) -- the prereqs are
> determined in advance and cannot be changed after attempting to install
them.
That is true. But in my opinion it is not Makefile.PL's business to do
this kind of "detection" it should be left to CPAN client (like "cpanm")
to decide.
In other words I think that JSON::MaybeXS should only declare proper:
"recommends" and/or "suggests" items in Makefile.PL and meta.(yml|json)
and that's all. Based on these "recommends"/"suggests" values CPAN client
should decide what modules it will try to install and want installation
failure can be ignored because they are only optional dependencies.
Show quoted text> You can however work around the problem in this particular case,
> either by installing JSON::XS (assuming it doesn't have the same
> compilation difficulties as Cpanel::JSON::XS), or by signalling that
> you don't want the XS component installed, with the PUREPERL_ONLY
argument:
Show quoted text>
> perl Makefile.PL PUREPERL_ONLY=1
Thanks for the workaround, it works. But it is a good workaround for
JSON::MaybeXS users not for an author of module depending on
JSON::MaybeXS.
In my case I am an author of 'CryptX' module and I used to use dependency
on 'JSON' module. Couple of months ago I got a pull request that it might
be a good idea to switch to 'JSON::MaybeXS' as it will use faster JSOM
implementations when available. So I have switched 'CryptX' to
'JSON::MaybeXS' as according the documentation it looked good and worked
on "common" platforms I use (Windows/Linux).
Later, there was a user who wanted to install my 'CryptX' on a HP-UX
* so he ran 'cpanm CryptX'
* JSON::MaybeXS was not installed so CPAN client started the installation¨
* now MaybeXS's Makefile.PL decided that it will forcefully require
Cpanel::JSON::XS
* Cpanel::JSON::XS was not available so CPAN client started the
installation
* unfortunately Cpanel::JSON::XS does not pass tests on HP-UX so it failed
* so JSON::MaybeXS installation failed as well
* so CryptX instalation had not even started as prereqs were not satisfied
* so bad luck
If you look at the scenario above from my point of view (as an author of
CryptX) being dependant on JSON::MaybeXS is more or less the same as being
dependant on Cpanel::JSON::XS (which I do not want).
For sure I can easily switch CryptX back to JSON or JSON::PP and avoid
JSON::MaybeXS. I only want you to know that despite the fact that the idea
behind JSON::MaybeXS is good is has some caveats and does not always work
well.
--
Karel