1Prereq(3) User Contributed Perl Documentation Prereq(3)
2
3
4
6 Test::Prereq - check if Makefile.PL has the right pre-requisites
7
9 # if you use Makefile.PL
10 use Test::More;
11 eval "use Test::Prereq";
12 plan skip_all => "Test::Prereq required to test dependencies" if $@;
13 prereq_ok();
14
15 # specify a perl version, test name, or module names to skip
16 prereq_ok( $version, $name, \@skip );
17
18 # if you use Module::Build
19 use Test::More;
20 eval "use Test::Prereq::Build";
21 plan skip_all => "Test::Prereq::Build required to test dependencies" if $@;
22 prereq_ok();
23
24 # or from the command line for a one-off check
25 perl -MTest::Prereq -eprereq_ok
26
28 The prereq_ok() function examines the modules it finds in blib/lib/,
29 blib/script, and the test files it finds in t/ (and test.pl). It fig‐
30 ures out which modules they use, skips the modules that are in the Perl
31 core, and compares the remaining list of modules to those in the PRE‐
32 REQ_PM section of Makefile.PL.
33
34 If you use Module::Build instead, see Test::Prereq::Build instead.
35
36 Modules Test::Prereq can't find
37
38 Module::Info only tells Test::Prereq which modules you used, not which
39 distribution they came in. This can be a problem for things in pack‐
40 ages like libnet, libwww, Tk, and so on. At the moment Test::Prereq
41 asks CPAN.pm to expand anything in PREREQ_PM to see if one of the dis‐
42 tributions you explicity list contains the module you actually used.
43 This might fail in some cases. Please send me anything that does not
44 do what you think it should.
45
46 Test::Prereq only asks CPAN.pm for help if it needs it, since CPAN.pm
47 can be slow if it has to fetch things from the network. Once it fetches
48 the right things, it should be much faster.
49
50 Problem with Module::Info
51
52 Module::Info appears to do something weird if a file it analyzes does
53 not use (or require) any modules. You may get a message like
54
55 Can't locate object method "name" via package "B::NULL" at
56 /usr/perl5.8.0/lib/site_perl/5.8.0/B/Module/Info.pm line 176.
57
58 Also, if a file cannot compile, Module::Info dumps a lot of text to the
59 terminal. You probably want to bail out of testing if the files do not
60 compile, though.
61
62 Problem with CPANPLUS
63
64 CPANPLUS apparently does some weird things, and since it is still young
65 and not part of the Standard Library, Test::Prereq's tests do not do
66 the right thing under it (for some reason). Test::Prereq cheats by
67 ignoring CPANPLUS completely in the tests---at least until someone has
68 a better solution. If you do not like that, you can set $EXCLUDE_CPAN‐
69 PLUS to a false value.
70
71 You should be able to do a 'make test' manually to make everything
72 work, though.
73
74 Warning about redefining ExtUtils::MakeMaker::WriteMakefile
75
76 Test::Prereq has its own version of ExtUtils::MakeMaker::WriteMakefile
77 so it can run the Makefile.PL and get the argument list of that func‐
78 tion. You may see warnings about this.
79
81 prereq_ok( [ VERSION, [ NAME [, SKIP_ARRAY] ] ] )
82 Tests Makefile.PL to ensure all non-core module dependencies are in
83 PREREQ_PM. If you haven't set a testing plan already, prereq_ok()
84 creates a plan of one test.
85
86 If you don't specify a version, prereq_ok assumes you want to com‐
87 pare the list of prerequisite modules to version 5.008005.
88
89 Valid versions come from Module::CoreList (which uses $[).
90
91 #!/usr/bin/perl
92 use Module::CoreList;
93 print map "$_\n", sort keys %Module::CoreList::version;
94
95 5.00307
96 5.004
97 5.00405
98 5.005
99 5.00503
100 5.00504
101 5.006
102 5.006001
103 5.006002
104 5.007003
105 5.008
106 5.008001
107 5.008002
108 5.008003
109 5.008004
110 5.008005
111 5.009
112 5.009001
113
114 prereq_ok attempts to remove modules found in blib and libraries
115 found in t from the reported prerequisites.
116
117 The optional third argument is an array reference to a list of
118 names that prereq_ok should ignore. You might want to use this if
119 your tests do funny things with require.
120
122 * set up a couple fake module distributions to test
123
124 * warn about things that show up in PREREQ_PM unnecessarily
125
127 This source is part of a SourceForge project which always has the lat‐
128 est sources in CVS, as well as all of the previous releases.
129
130 http://sourceforge.net/projects/brian-d-foy/
131
132 If, for some reason, I disappear from the world, one of the other mem‐
133 bers of the project can shepherd this module appropriately.
134
136 Many thanks to:
137
138 Andy Lester, Slavin Rezic, Randal Schwartz, Iain Truskett, Dylan Martin
139
141 brian d foy, "<bdfoy@cpan.org>"
142
144 Copyright 2002-2007, brian d foy, All rights reserved
145
146 This software is available under the same terms as perl.
147
148
149
150perl v5.8.8 2007-03-17 Prereq(3)