NAME
Test::Prereq - check if Makefile.PL has the right pre-requisites
SYNOPSIS
# if you use Makefile.PL use Test::Prereq; prereq_ok();
# specify a perl version, test name, or module names to skip prereq_ok( $version, $name, \@skip );
# if you use Module::Build use Test::Prereq::Build; prereq_ok();
# or from the command line for a one-off check perl -MTest::More=tests,1 -MTest::Prereq -eprereq_ok
DESCRIPTION
THIS IS ALPHA SOFTWARE. IT HAS SOME PROBLEMS.
The prereq_ok() function examines the modules it finds in blib/lib/ and the test files it finds in t/. It figures out which modules they use, skips the modules that are in the Perl core, and compares the remaining list of modules to those in the PREREQ_PM section of Makefile.PL. If you use Module::Build instead, see Test::Prereq::Build instead.
Modules Test::Prereq can't find
Module::Info only tells Test::Prereq which modules you used, not which distribution they came in. This can be a problem for things in packages like libnet, libwww, Tk, and so on. I do not have a good solution for this right now, but you can add those modules to the anonymous array which is the third parameter to prereq_ok.
Problem with Module::Info
Module::Info appears to do something wierd if a file it analyzes does not use (or require) any modules. You may get a message like
Can't locate object method "name" via package "B::NULL" at
/usr/perl5.8.0/lib/site_perl/5.8.0/B/Module/Info.pm line 176.
Also, if a file cannot compile, Module::Info dumps a lot of text to the terminal. You probably want to bail out of testing if the files do not compile anyway.
FUNCTIONS
- prereq_ok( [ VERSION, [ NAME [, SKIP_ARRAY] ] ] )
-
If you don't specify a version, prereq_ok assumes you want to compare the list of prerequisite modules to version 5.6.1.
Valid version come from Module::CoreList (which uses $[):
5.008 5.00307 5.00405 5.00503 5.007003 5.004 5.005 5.006 5.006001
prereq_ok attempts to remove modules found in blib and libraries found in t from the reported prerequisites.
The optional third argument is an array reference to a list of names that prereq_ok should ignore. You might want to use this if your tests do funny things with require.
TO DO
* skip the modules included in the distribution. at the moment I skip things that match the string in NAME in WriteMakefile and I don't think that's a good solution.
* figure out which modules depend on others, and then apply that to what i see in the PREREQ_PM.
SOURCE AVAILABILITY
This source is part of a SourceForge project which always has the latest sources in CVS, as well as all of the previous releases.
https://sourceforge.net/projects/brian-d-foy/
If, for some reason, I disappear from the world, one of the other members of the project can shepherd this module appropriately.
CONTRIBUTORS
Thanks to:
Andy Lester, Slavin Rezic, Iain Truskett
AUTHOR
brian d foy, <bdfoy@cpan.org>
COPYRIGHT
Copyright 2002, brian d foy, All Rights Reserved.
You may use, modify, and distribute this package under the same terms as Perl itself.