Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

test::useallmodules(3pm) [debian man page]

Test::UseAllModules(3pm)				User Contributed Perl Documentation				  Test::UseAllModules(3pm)

NAME
Test::UseAllModules - do use_ok() for all the MANIFESTed modules SYNOPSIS
# basic usage use strict; use Test::UseAllModules; BEGIN { all_uses_ok(); } # if you also want to test modules under t/lib use strict; use Test::UseAllModules under => qw(lib t/lib); BEGIN { all_uses_ok(); } # if you have modules that'll fail use_ok() for themselves use strict; use Test::UseAllModules; BEGIN { all_uses_ok except => qw( Some::Dependent::Module Another::Dependent::Module ^Yet::Another::Dependent::.* # you can use regex ) } DESCRIPTION
I'm sick of writing 00_load.t (or something like that) that'll do use_ok() for every module I write. I'm sicker of updating 00_load.t when I add another file to the distro. This module reads MANIFEST to find modules to be tested and does use_ok() for each of them. Now all you have to do is update MANIFEST. You don't have to modify the test any more (hopefully). EXPORTED FUNCTION
all_uses_ok Does Test::More's use_ok() for every module found in MANIFEST. If you have modules you don't want to test, give those modules or some regex rules as the argument. The word 'except' is ignored as shown above. As of 0.11, you can also test modules under arbitrary directories by providing a directory list at the loading time (the word 'under' is ignored as shown above). Modules under the lib directory are always tested. PROTECTED FUNCTION
_get_module_list Returns module paths to test. This function will not be exported. If you want to use this (see below), you always need to call it by the full qualified name. NOTES
As of 0.03, this module calls BAIL_OUT of Test::More if any of the use_ok tests should fail. (Thus the following tests will be ignored. Missing or unloadable modules cause a lot of errors of the same kind.) As of 0.12, you can add extra tests before/after all_uses_ok() if you explicitly declare test plan like this. use strict; use warnings; use Test::More; use Test::UseAllModules; use Test::NoWarnings; plan tests => Test::UseAllModules::_get_module_list() + 1; all_uses_ok(); # and extra nowarnings test SEE ALSO
There're several modules like this on the CPAN now. Test::Compile and a bit confusing Test::LoadAllModules try to find modules to test by traversing directories. I'm not a big fun of them as they tend to find temporary or unrelated modules as well, but they may be handier especially if you're too lazy to update MANIFEST every time. AUTHOR
Kenichi Ishigaki, <ishigaki@cpan.org> COPYRIGHT AND LICENSE
Copyright (C) 2006 by Kenichi Ishigaki This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2009-05-27 Test::UseAllModules(3pm)

Check Out this Related Man Page

Test::Signature(3pm)					User Contributed Perl Documentation				      Test::Signature(3pm)

NAME
Test::Signature - Automated SIGNATURE testing SYNOPSIS
# This is actually the t/0-signature.t file from this distribution. use Test::More tests => 1; use Test::Signature; signature_ok(); ABSTRACT
"Test::Signature" verifies that the "Module::Signature" generated signature of a module is correct. DESCRIPTION
"Module::Signature" allows you to verify that a distribution has not been tampered with. "Test::Signature" lets that be tested as part of the distribution's test suite. By default, if "Module::Signature" is not installed then it will just say so and not fail the test. That can be overridden though. IMPORTANT: This is not a substitute for the users verifying the distribution themselves. By the time this module is run, the users will have already run your Makefile.PL or Build.PL scripts which could have been compromised. This module is more for ensuring you've updated your signature appropriately before distributing, and for preventing accidental errors during transmission or packaging. FUNCTIONS
"signature_ok" is exported by default. "signature_force_ok" must be explicitly exported. signature_ok() This will test that the "Module::Signature" generated signature is valid for the distribution. It can be given two optional parameters. The first is a name for the test. The default is "Valid signature". The second is whether a lack of "Module::Signature" should be regarded as a failure. The default is 0 meaning 'no'. # Test with defaults signature_ok() # Test with custom name signature_ok( "Is the signature valid?" ); # Test with custom name and force C<Module::Signature> to exist signature_ok( "Is the signature valid?", 1 ); # Test without custom name, but forcing signature_ok( undef, 1 ); signature_force_ok() This is equivalent to calling "signature_ok( $name, 1 )" but is more readable. # These are equivalent: signature_force_ok( "Is our signature valid?" ); signature_ok( "Is our signature valid?", 1); # These are equivalent: signature_force_ok(); signature_ok( undef, 1 ); NOTES ON USE
MANIFEST and MANIFEST.SKIP It is imperative that your MANIFEST and MANIFEST.SKIP files be accurate and complete. If you are using "ExtUtils::MakeMaker" and you do not have a MANIFEST.SKIP file, then don't worry about the rest of this. If you do have a MANIFEST.SKIP file, or you use "Module::Build", you must read this. Since the test is run at "make test" time, the distribution has been made. Thus your MANIFEST.SKIP file should have the entries listed below. If you're using "ExtUtils::MakeMaker", you should have, at least: #defaults ^Makefile$ ^blib/ ^blibdirs$ ^pm_to_blib$ These entries are part of the default set provided by "ExtUtils::Manifest", which is ignored if you provide your own MANIFEST.SKIP file. If you are using "Module::Build", there is no default MANIFEST.SKIP so you must provide your own. It must, minimally, contain: ^Build$ ^Makefile$ ^_build/ ^blib/ If you don't have the correct entries, "Module::Signature" will complain that you have: ==> MISMATCHED content between MANIFEST and distribution files! <== You should note this during normal development testing anyway. Use with Test::Prereq "Test::Prereq" tends to get a bit particular about modules. If you're using the force option with "Test::Signature" then you will have to specify that you expect "Module::Signature" as a prerequisite. "Test::Signature" will not have it as a prerequisite since that would defeat the point of having the force variant. If you are using "ExtUtils::MakeMaker" you should have a line like the following in your Makefile.PL: 'PREREQ_PM' => { 'Test::Signature' => '1.04', 'Module::Signature' => '0.22', 'Test::More' => '0.47', }, If using "Module::Build", your Build.PL should have: build_requires => { 'Test::Signature' => '1.04', 'Module::Signature' => '0.22', 'Test::More' => '0.47', }, If you just want the default behaviour of testing the signature if and only if the user already has "Module::Signature" installed, then you will need something like the following code. The example uses "Module::Build" format but it should be trivial for you to translate to "ExtUtils::MakeMaker". #!/usr/bin/perl -w use strict; use Module::Build 0.18; my @extra_build; eval { require Module::Signature }; if (!$@ or $Test::Prereq::VERSION) { push @extra_build, "Module::Signature" => '0.22' } my $m = Module::Build->new( dist_name => 'WWW-Yahoo-Groups', dist_version => '1.7.7', license => 'perl', requires => { # various modules 'perl' => '5.6.0', }, build_requires => { 'Test::More' => 0.47, 'Test::Prereq' => 0.19, 'Test::Prereq::Build' => 0.04, 'Test::Signature' => 1.04, @extra_build, }, ); $m->create_build_script; If you have any questions on using this module with "Test::Prereq", just email me (address below). Use with Module::Install "Module::Install" is a module to assist in the bundling of build prerequisite modules in packages. Well, among other things. "Test::Signature" is a perfect candidate for such a module. As it's a module aimed purely at those writing modules rather than those using them. Here's a good way to use it: Make a test file (say, t/00sig.t) that contains the following: use lib 'inc'; use Test::More tests => 1; use Test::Signature; signature_ok(); In your Makefile.PL (or Build.PL if appropriate) add: include 'Test::Signature'; And that's it! You don't have to specify it as a prerequisite or anything like that because "Module::Install" will include it in your distribution. And you don't have to worry about size because "Module::Install" strips out all this waffling POD. THANKS
Arthur Bergman for suggesting the module. Audrey Tang for writing Module::Signature, and making some suggestions. Tels suggested testing network connectivity to Audrey; Audrey added that to "Module::Signature" 0.16 and I (Iain Truskett) added it to this module (as of 1.03). BUGS
Please report bugs at <bug-test-signature@rt.cpan.org> or via the web interface at <http://rt.cpan.org> AUTHORS
Audrey Tang <cpan@audreyt.org> Original author: Iain Truskett <spoon@cpan.org>, now passed away. LICENSE AND COPYRIGHT
Copyright 2002, 2003 by Iain Truskett. Copyright 2003, 2007 by Audrey Tang <cpan@audreyt.org>. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl, Module::Signature, Test::More. Module::Build, ExtUtils::Manifest, ExtUtils::MakeMaker. Test::Prereq, Module::Install. perl v5.10.0 2007-10-15 Test::Signature(3pm)
Man Page