SYNOPSIS

  $ cat t/01distribution.t
  use Test::More;

  BEGIN {
        eval {
                require Test::Distribution;
        };
        if($@) {
                plan skip_all => 'Test::Distribution not installed';
        }
        else {
                import Test::Distribution;
        }
   }

  $ make test
  ...

DESCRIPTION

When using this module in a test script, it goes through all the modules in your distribution, checks their \s-1POD\s0, checks that they compile ok and checks that they all define a $VERSION.

This module also performs a numer of test on the distribution itself. It checks that your files match your \s-1SIGNATURE\s0 file if you have one. It checks that your distribution isn't missing certain 'core' description files. It checks to see you havent' missed out listing any pre-requisites in Makefile.PL.

It defines its own testing plan, so you usually don't use it in conjunction with other \*(C`Test::*\*(C' modules in the same file. It's recommended that you just create a one-line test script as shown in the \s-1SYNOPSIS\s0 above. However, there are options...

\s-1NOTE\s0 If you do not specify any options Test::Distribution will run all test types except signature testing which must always be explicitly switched on.

In the future I may change the default to run no tests at all as this sounds safer. Mail me if you disagree.

OPTIONS

On the line in which you \*(C`use()\*(C' this module, you can specify named arguments that influence the testing behavior. Specifies that in addition to the tests run by this module, your test script will run additional tests. In other words, this value influences the test plan. For example: use Test::Distribution tests => 1; use Test::More; is($foo, $bar, 'baz'); It is important that you don't specify a \*(C`tests\*(C' argument when using \*(C`Test::More\*(C' or other test modules as the plan is handled by \*(C`Test::Distribution\*(C'. \s-1DEPRECATED\s0 \s-1FEATURE\s0. I plan to remove this in the future unless I'm contacted by someone that says they find this useful. Specifies that only certain sets of tests are to be run. Possible values are those mentioned in \s-1TEST\s0 \s-1TYPES\s0 below. For example, if you only want to run the \s-1POD\s0 tests, you could say: use Test::Distribution only => 'pod'; To specify that you only want to run the \s-1POD\s0 tests and the \*(C`use\*(C' tests, and also that you are going to run two tests of your own, use: use Test::Distribution only => [ qw/pod use/ ], tests => 2; Note that when you specify the \*(C`versions\*(C' option, the \*(C`use\*(C' option is automatically added. This is because in order to get a module's $VERSION, it has to be loaded. In this case we might as well run a \*(C`use\*(C' test. The value for \*(C`only\*(C' can be a string or a reference to a list of strings. Specifies that certain types of tests should not be run. All tests not mentioned in this argument are run. For example, if you want to test everything except the \s-1POD\s0, use: use Test::Distribution not => 'pod'; The value for \*(C`not\*(C' can be a string or a reference to a list of strings. Although it doesn't seem to make much sense, you can use both \*(C`only\*(C' and \*(C`not\*(C'. In this case only the tests specified in \*(C`only\*(C', but not \*(C`not\*(C' are run (if this makes any sense). If you test this to a true value, as well as testing that each module has a $VERSION defined, Test::Distribution will also ensure that the $VERSION matches that of the distribution. You can set this to be a hash reference of options to pass to Test::Pod::Coverage's pod_coverage_ok method (which in turn gets passed to Pod::Coverage.

TEST TYPES

Here is a description of the types of tests available. Checks that the following files exist:

Changes or ChangeLog
\s-1MANIFEST\s0
\s-1README\s0
Build.PL or Makefile.PL

Checks whether all \*(C`use()\*(C'd modules that aren't in the perl core are also mentioned in Makefile.PL's \*(C`PREREQ_PM\*(C'. Checks for \s-1POD\s0 errors in files Checks for Pod Coverage If the distribution has a \s-1SIGNATURE\s0 file, checks the \s-1SIGNATURE\s0 matches the files. This \*(C`use()\*(C's the modules to make sure the load happens ok. Checks that all packages define $VERSION strings.

EXPOSED INTERNALS

There are a few subroutines to help you see what this module is doing. Note that these subroutines are neither exported nor exportable, so you have to call them fully qualified. This is a list of packages that have been found. That is, we assume that each file contains a package of the name indicated by the file's relative position. For example, a file in \*(C`blib/lib/Foo/Bar.pm\*(C' is expected to be available via \*(C`use Foo::Bar\*(C'. This is a list of files that tests have been run on. The filenames are relative to the distribution's root directory, so they start with \*(C`blib/lib\*(C'. This is the number of tests that this module has run, based on your specifications.

INSTALLATION

This module uses Module::Build for its installation. To install this module type the following:

perl Build.PL ./Build ./Build test ./Build install

If you do not have Module::Build type:

perl Makefile.PL

to fetch it. Or use \s-1CPAN\s0 or \s-1CPANPLUS\s0 and fetch it \*(L"manually\*(R".

DEPENDENCIES

This module requires these other modules and libraries:

File::Basename File::Find::Rule File::Spec Test::More

This module has these optional dependencies:

Module::CoreList Test::Pod Test::Pod::Coverage

If \*(C`Module::CoreList\*(C' is missing, the \*(C`prereq\*(C' tests are skipped.

If \*(C`Test::Pod\*(C' is missing, the \*(C`pod\*(C' tests are skipped.

TODO

Just because these items are in the todo list, does not mean they will actually be done. If you think one of these would be helpful say so - and it will then move up on my priority list.

  • Module::Build support [currently waiting for a fix on Test::Prereq ]

FEATURE IDEAS

This would mandate that there should be a test for each exported symbol of each module.

Let me know what you think of these ideas. Are they necessary? Unnecessary? Do you have feature requests of your own?

BUGS

To report a bug or request an enhancement use \s-1CPAN\s0's excellent Request Tracker.

SOURCE AVAILABILITY

This source is part of a SourceForge project which always has the latest sources in svn.

http://sourceforge.net/projects/sagar-r-shah/

AUTHORS

Marcel Gru\*:nauer <[email protected]>

Sagar R. Shah

OTHER CREDITS

This module was inspired by a use.perl.org journal entry by \*(C`brian d foy\*(C' (see <http://use.perl.org/~brian_d_foy/journal/7463>) where he describes an idea by Andy Lester.

COPYRIGHT & LICENSE

Copyright 2002-2003 Marcel Gru\*:nauer. All rights reserved.

Copyright 2003-2007, Sagar R. Shah, All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

RELATED TO Test::Distribution…

perl\|(1), ExtUtils::Manifest\|(3pm), File::Find::Rule\|(3pm), Module::CoreList\|(3pm), Test::More\|(3pm), Test::Pod\|(3pm), Test::Pod::Coverage\|(3pm), Test::Signature\|(3pm).