1Test::Prereq(3)       User Contributed Perl Documentation      Test::Prereq(3)
2
3
4

NAME

6       Test::Prereq - check if Makefile.PL has the right pre-requisites
7

SYNOPSIS

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
27           #The prerequisites test take quite some time so the following construct is
28           #recommended for non-author testers
29               use Test::More;
30               eval "use Test::Prereq::Build";
31
32               my $msg;
33               if ($@) {
34                   $msg = 'Test::Prereq::Build required to test dependencies';
35               } elsif (not $ENV{TEST_AUTHOR}) {
36                   $msg = 'Author test.  Set $ENV{TEST_AUTHOR} to a true value to run.';
37               }
38               plan skip_all => $msg if $msg;
39               prereq_ok();
40

DESCRIPTION

42       The "prereq_ok()" function examines the modules it finds in blib/lib/,
43       blib/script, and the test files it finds in t/ (and test.pl). It
44       figures out which modules they use and compares that list of modules to
45       those in the "PREREQ_PM" section of Makefile.PL.
46
47       If you use "Module::Build" instead, see Test::Prereq::Build instead.
48
49   Warning about redefining ExtUtils::MakeMaker::WriteMakefile
50       "Test::Prereq" has its own version of
51       "ExtUtils::MakeMaker::WriteMakefile" so it can run the Makefile.PL and
52       get the argument list of that function.  You may see warnings about
53       this.
54

FUNCTIONS

56       prereq_ok( [ VERSION, [ NAME [, SKIP_ARRAY] ] ] )
57           Tests Makefile.PL to ensure all non-core module dependencies are in
58           "PREREQ_PM". If you haven't set a testing plan already,
59           "prereq_ok()" creates a plan of one test.
60
61           If you don't specify a version, "prereq_ok" assumes you want to
62           compare the list of prerequisite modules to the version of perl
63           running the test.
64
65           Valid versions come from "Module::CoreList" (which uses $]).
66
67                   #!/usr/bin/perl
68                   use Module::CoreList;
69                   print map "$_\n", sort keys %Module::CoreList::version;
70
71           "prereq_ok" attempts to remove modules found in lib/ and libraries
72           found in t/ from the reported prerequisites.
73
74           The optional third argument is an array reference to a list of
75           names that "prereq_ok" should ignore. You might want to use this if
76           your tests do funny things with "require".
77
78           Versions prior to 1.038 would use CPAN.pm to virtually include
79           prerequisites in distributions that you declared explicitly. This
80           isn't really a good idea. Some modules have moved to different
81           distributions, so you should just specify all the modules that you
82           use instead of relying on a particular distribution to provide
83           them. Not only that, expanding distributions with CPAN.pm takes
84           forever.
85
86           If you want the old behavior, set the
87           "TEST_PREREQ_EXPAND_WITH_CPAN" environment variable to a true
88           value.
89

TO DO

91       •   set up a couple fake module distributions to test
92
93       •   warn about things that show up in "PREREQ_PM" unnecessarily
94

SOURCE AVAILABILITY

96       This source is in Github:
97
98               http://github.com/briandfoy/test-prereq
99

CONTRIBUTORS

101       Many thanks to:
102
103       Andy Lester, Slavin Rezić, Randal Schwartz, Iain Truskett, Dylan Martin
104

AUTHOR

106       brian d foy, "<bdfoy@cpan.org>"
107
109       Copyright © 2002-2016, brian d foy <bdfoy@cpan.org>. All rights
110       reserved.  This software is available under the Artistic License 2.
111
112
113
114perl v5.32.1                      2021-01-27                   Test::Prereq(3)
Impressum