trusty (3) Test::Prereq.3pm.gz

Provided by: libtest-prereq-perl_1.038-1_all bug

NAME

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

SYNOPSIS

               # if you use Makefile.PL
               use Test::More;
               eval "use Test::Prereq";
               plan skip_all => "Test::Prereq required to test dependencies" if $@;
               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::More;
               eval "use Test::Prereq::Build";
               plan skip_all => "Test::Prereq::Build required to test dependencies" if $@;
               prereq_ok();

               # or from the command line for a one-off check
               perl -MTest::Prereq -eprereq_ok

           #The prerequisites test take quite some time so the following construct is
           #recommended for non-author testers
               use Test::More;
               eval "use Test::Prereq::Build";

               my $msg;
               if ($@) {
                   $msg = 'Test::Prereq::Build required to test dependencies';
               } elsif (not $ENV{TEST_AUTHOR}) {
                   $msg = 'Author test.  Set $ENV{TEST_AUTHOR} to a true value to run.';
               }
               plan skip_all => $msg if $msg;
               prereq_ok();

DESCRIPTION

       The "prereq_ok()" function examines the modules it finds in blib/lib/, blib/script, and the test files it
       finds in t/ (and test.pl). 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. At the moment
       "Test::Prereq" asks CPAN.pm to expand anything in "PREREQ_PM" to see if one of the distributions you
       explicity list contains the module you actually used. This might fail in some cases. Please send me
       anything that does not do what you think it should.

       "Test::Prereq" only asks CPAN.pm for help if it needs it, since CPAN.pm can be slow if it has to fetch
       things from the network. Once it fetches the right things, it should be much faster.

   Problem with Module::Info
       "Module::Info" appears to do something weird 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, though.

   Problem with CPANPLUS
       "CPANPLUS" apparently does some weird things, and since it is still young and not part of the Standard
       Library, "Test::Prereq"'s tests do not do the right thing under it (for some reason). "Test::Prereq"
       cheats by ignoring "CPANPLUS" completely in the tests---at least until someone has a better solution. If
       you do not like that, you can set $EXCLUDE_CPANPLUS to a false value.

       You should be able to do a 'make test' manually to make everything work, though.

   Warning about redefining ExtUtils::MakeMaker::WriteMakefile
       "Test::Prereq" has its own version of "ExtUtils::MakeMaker::WriteMakefile" so it can run the Makefile.PL
       and get the argument list of that function.  You may see warnings about this.

FUNCTIONS

       prereq_ok( [ VERSION, [ NAME [, SKIP_ARRAY] ] ] )
           Tests Makefile.PL to ensure all non-core module dependencies are in "PREREQ_PM". If you haven't set a
           testing plan already, "prereq_ok()" creates a plan of one test.

           If you don't specify a version, "prereq_ok" assumes you want to compare the list of prerequisite
           modules to the version of perl running the test.

           Valid versions come from "Module::CoreList" (which uses $]).

                   #!/usr/bin/perl
                   use Module::CoreList;
                   print map "$_\n", sort keys %Module::CoreList::version;

           "prereq_ok" attempts to remove modules found in lib/ 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".

           Versions prior to 1.038 would use CPAN.pm to virtually include prerequisites in distributions that
           you declared explicitly. This isn't really a good idea. Some modules have moved to different
           distributions, so you should just specify all the modules that you use instead of relying on a
           particular distribution to provide them. Not only that, expanding distributions with CPAN.pm takes
           forever.

           If you want the old behavior, set the "TEST_PREREQ_EXPAND_WITH_CPAN" environment variable to a true
           value.

TO DO

       * set up a couple fake module distributions to test

       * warn about things that show up in "PREREQ_PM" unnecessarily

SOURCE AVAILABILITY

       This source is in Github:

               http://github.com/briandfoy/test-prereq

CONTRIBUTORS

       Many thanks to:

       Andy Lester, Slavin ReziX, Randal Schwartz, Iain Truskett, Dylan Martin

AUTHOR

       brian d foy, "<bdfoy@cpan.org>"

       Copyright 2002-2014, brian d foy, All rights reserved

       This software is available under the same terms as perl.