I try to build a Perl distribution for a home-made module, from the Module::Starter base. Every test pass on my machine, but when I upload it to CPAN to get some more universal tests from cpantesters.org, some test failed on other architectures or OS, but I can't understand why. I can see in test reports that some of my prerequisites are not installed before testing but I would like it to.
I've tried to list these dependencies into the Makefile.PL
PREREQ_PM
hash and then in the TEST_REQUIRES
hash, but it didn't changed a lot of results.
Then, when I've removed the dependencies from my local machine and tried to install my module using Cpanm
, it downloads dependencies first, test passed and install has been a success.
This is my first try for a module, so I think I am missing something, maybe I am too used of the Cpanm
magic. Thanks for any help.
The problem is something different. Andreas' smoker very probably built the dependency App::Ack
(which looks in the fail reports like being absent) successfully. But here come at least two problems:
PERL5LIB
environment variable, so make test
usually works (To be more specific, if the install Module
command is used in the CPAN shell, then all dependencies are installed immediately. If the test Module
command is used, then dependencies are only built, but not installed. The CPAN user can do the installation later using install_tested
). So it may be that App::Ack
is not installed here, just built. Especially this means that the ack
script is not installed in the final location.ack
wouldn't be installed in /usr/bin
or /usr/local/bin
, but in the bin directory belonging to this perl. This directory may or may not be in the user's PATH
at all. So you cannot assume that can_run("ack")
works here. A workaround here is to add $Config{scriptdir}
temporarily to $ENV{PATH}
. Another solution would be to use the App module instead of the script, if it's possible. Unfortunately it looks like ack
can only be called as a script.If you look at a sample fail report, then you can see that App::Ack
was installed (it appears in the PREREQUISITES section both under requires and build_requires, you can also see which App::Ack
version is installed in the "HAVE" column). You can also see the user's PATH
(in the ENVIRONMENT section). And you may guess about the scriptdir for this perl, it's usually the same directory where the perl binary itself is installed, and the path to current perl is visible in $^X
(under "Perl special variables").
If you want to reproduce the behavior, then you need to deinstall ack
from your machine, build a custom perl using ./configure.gnu --prefix=/path/to/custom/perl-5.X.Y
, and use this perl for tests.