On 2010.7.31 10:08 AM, Bill Moseley wrote: > ExtUtils::MakeMaker says fror PREREQ_FATAL > > Note: see Test::Harness for a shortcut for stopping tests early if > you are missing dependencies and are afraid that users might > use your > module with an incomplete environment. > > Unless I'm missing something, it seems that reference is long gone. > Anyone remember what was suggested?
That would be "bail out" and its Test::More function for invoking it BAIL_OUT(). You rarely need bail out. Assuming full coverage the tests will fail fine on their own when they can't find the required module. Its only to save the user from having to see the same failure over and over. Generally you might have a t/00compile.t test which checks the library compiles and only bail out if that fails. That will run first and end the testing early. Those docs are a bit out of date. I've rewritten them to refer to Test::More's BAIL_OUT. > As I might have commented here back in April, the correct approach would > be to test for needed features that are supported in a given version of > a dependency. But, in reality what happens is a developer needs to use > some CPAN module in our code and just looks at the version they are > using for their development and adds that to Makefile.PL. They are > saying "according to my local testing version 1.2.3 of Foo::Bar works > with these changes" so they just set a dependency on 1.2.3. Yes, much relies on CPAN modules retaining the backwards compatibility. Most do a good job of that. > I have a custom script that runs from cron that checks out our app and > then runs Makefile.PL and make test and reports any errors to the > development team -- the idea is to catch any check ins that break > existing tests and alert the developers quickly. So, part of that would > be to report any missing dependencies on the test environment. > Makefile.PL doesn't return false be default for missing dependencies so > that's why I looked at using PREREQ_FATAL. If you're missing dependencies and your tests don't fail, you need better tests. :-/ I highly recommend against hard coding PREREQ_FATAL into your Makefile.PL. It wrecks the normal procedures for resolving dependencies, they depend on Makefile.PL successfully completing and generating a Makefile. Module::Build has an API to check the prerequisites (see prereq_failures() in Module::Build::API) but MakeMaker has no such thing. Generally you screen scrape the output of Makefile.PL. -- "Clutter and overload are not an attribute of information, they are failures of design" -- Edward Tufte