On Tuesday 13 November 2007 5:38 am, you wrote:
> In the past week I've had 4 cpan-test reports for failures of which 2
> were genuine mistakes not working on very old Perls (thus proving the
> benefit of cpan-testers - thanks) and 2 were down to a missing module
> dependency. Before then all cpan-test failures were actual module errors
> not related to failure to have a module my module depends on so I'm
> assuming the way cpan-testing is done has changed.
[.....snip.....]
Ah... you've discovered the joy of "I need this thing at the moment that I
run 'perl Makefile.PL'".... a "configuration requirement".
I've been bitten several times by this on packages I've been working on, and
unfortunately, there -ISN'T- a spectacular solution yet.
If you've got a META.yml file, you can add "configure_requires" to it. This
is supposed to tell package management tools like CPAN.pm and CPANPLUS that
you actually need this thing at the moment you do initial configuration.
UNFORTUNATELY, though, its only really supported by the latest CPAN.pm;
CPANPLUS doesn't support it yet, and neither do older versions of CPAN. Its
a step in the right direction, but it'll take a bit of time to get there.
In the interim, though, what I've been doing myself in some of my packages to
try to address this, is to check for it in Makefile.PL/Build.PL -=BEFORE=-
outputting anything, and to then spit out a warning message and "exit 0" if
its no there. The trick here is to (a) not generate any sort of Makefile or
Build, and (b) to "exit 0" (no error condition). This'll turn CPAN
Tester "FAIL"s into "NA"s so they're at least not a total black mark against
what you're seeing. Still sucks IMHO, but its at least better than a
failure.
> After discussion with the cpan testers involved I've been advised to
> install the module my module depends on if it was not found. However,
> I'm having problems with this idea because I believe although it may
> lead to a test success 1. I don't think it helps real people install my
> module 2. I don't think it guarantees not failing because of the missing
> module. Here is the background:
As for anyone who tells you to go out and install the module yourself, I'd be
tempted to tell them to take a long walk off a short pier; that's what tools
like CPAN(PLUS) are for. My build scripts should only have to do just
that; -build- my package. They're not responsible for going out and
boot-strapping somebody elses environment so that its got everything it
needs. Tell them they're missing something? Sure. Go out and get it for
them? IMHO not part of a "build/make" script.
> I'd also like to know the definitive way of failing a Makefile.PL
> because of a missing external library without causing a test failure.
Ah... try the above; (a) don't generate a Makefile (so do your testing before
hand, probably in an eval{} block), and (b) exit 0.
--
Graham TerMarsch
Howling Frog Internet Development, Inc.