PREREQ_PM
specifies the runtime prerequisites, but how to specify which modules are required to run the test cases?
Should I use BUILD_REQUIRES
for this?
PREREQ_PM
specifies the runtime prerequisites, but how to specify which modules are required to run the test cases?
Should I use BUILD_REQUIRES
for this?
As of ExtUtils::MakeMaker 6.64, there is a
TEST_REQUIRES
parameter.If the tests fail without a module, then I list it in
PREREQ_PM
regardless of whether it's needed for testing or for running the module.If I need modules for some tests, but they are not needed to run the module, I detect those when the tests are run, and I skip the tests (with a PASS) if I can't find them.
I don't think there is any field in ExtUtils::MakeMaker for what you want.
The CPAN::Meta::Spec defines how modules communicate their prerequisites to the toolchain. The version 2 spec revised the way prerequisites are listed. The
test
phase now has its own list of prerequisites.But MakeMaker hasn't been updated for the v2 spec, and likely never will be. The only fully-compliant v2 distribution tool I know of is Dist::Zilla (and I recommend it for more reasons than that).
When CPAN::Meta::Converter converts from the v2 spec to v1.4, it merges the
test
requirements intobuild_requires
.So yes, if you stick with MakeMaker, any modules that are required to run the tests should be listed in
BUILD_REQUIRES
.PREREQ_PM
should contain only modules that are still required after the module is installed.