On 8/8/21 5:47 PM, David Cantrell wrote:
On 08/08/2021 20:34, Diab Jerius wrote:
Here's the problem, illustrated by this CPAN testers failure:
http://www.cpantesters.org/cpan/report/2f961e48-6bf6-1014-90df-a468c69b7236
The smoker has versions of Cpanel::JSON::XS and YAML::XS which are
older than my required versions. Since the ::XS versions are
prioritized over the ::PP versions, the code uses those and thus
fails the tests. I presume that because the ::XS versions are
recommendations rather than requirements, they weren't updated to the
versions that the code requires.
Is there some way of triggering an update to the required versions
via the metadata, or should I put a runtime version check into the
tests and skip if the appropriate versions aren't installed?
You can check what's already installed in your Makefile.PL or
equivalent, and prompt the user if you can't figure out what to do
automatically. I ASSume that the correct thing to do would be to do as
you currently do if none of your deps are installed, but if any are
installed you'd want to tell EU::MM's WriteMakefile function that you
have a runtime requirement for updated versions.
Use the prompt() function from ExtUtils::MakeMaker as that will pay
attention to the PERL_MM_USE_DEFAULT env var. You may also want to pay
attention to AUTOMATED_TESTING and NONINTERACTIVE_TESTING. In
particular you will find that CPAN-testers generally set all three of
those.
Vary as appropriate if you use a different build system.
This is good advice. I'm ambivalent about prompting the user when the
functionality is optional. I've also had varied success when using
installers such as cpanm with prompts & warnings, as there's a lot less
info presented to the user.
What I should probably do is split the distribution into core and
optional components.
Thanks!
Diab