24 Oct 2020 00:11:18 UTC
- Distribution: Test-CPANfile
- Module version: 0.08
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (172 / 0 / 0)
- KwaliteeBus factor: 1
- 79.82% Coverage
- License: perl_5
- Activity24 month
- Download (10.9KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- SEE ALSO
- COPYRIGHT AND LICENSE
Test::CPANfile - see if cpanfile lists every used modules
# By default, this module tests if cpanfile has all the used modules. use Test::CPANfile; use Test::More; cpanfile_has_all_used_modules(); done_testing; # You can use an optional CPAN package index to see if # a sibling of a used-but-not-listed-in-cpanfile module # is listed. use Test::CPANfile; use Test::More; use CPAN::Common::Index::Mirror; my $index = CPAN::Common::Index::Mirror->new; cpanfile_has_all_used_modules( parser => [qw/:installed/], index => $index, ); done_testing; # You can ignore specific files use Test::CPANfile; use Test::More; # ignore prereqs in lib/Foo/Bar/Win32.pm, lib/Foo/Bar/Mac.pm etc cpanfile_has_all_used_modules( ignore => [qw!lib/Foo/Bar/!], ); done_testing; # Or you can scan extra files use Test::CPANfile; use Test::More; cpanfile_has_all_used_modules( lib => [glob 'extlib/*/lib'], ); done_testing;
This module tests if cpanfile lists every
used modules or not.
It's ok if you list a module that is
evaled in the code, or a module that does not appear in the code, as
requires, but it complains if a
used module is listed as
You can pass an optional hash, which is passed to Perl::PrereqScanner::NotQuiteLite::App's constructor to change its behavior. Notable options are:
- exclude_core, perl_version
Test::CPANfile usually ignores prerequisites that are bundled in the Perl core (of 5.008001 by default; you can change this with
perl_versionoption). If you do not want this, explicitly set
exclude_coreoption to false.
Test::CPANfile usually ignores
t/directory if modules in those .pm files are not used in
.tfiles. With this option, Test::CPANfile looks for those
t/, regardless they are used in
.tfiles or not. This is useful if you are using a test module that automatically loads modules under
t/. If Test::Class family is used under
t/, this option is implicitly set.
Set a list of paths Test::CPANfile should ignore. This is useful when your distribution has a set of OS-specific modules, for example.
You can also specify a regexp instead of a list of paths. If this is set,
ignoreoptions are ignored.
If your distribution has an uncommon directory layout for some reasons, you can add extra directories to scan. This also might help when you have private modules that are not uploaded on the CPAN. Put them under
extlib/for example, and add the directory to
libs, then Test::CPANfile also looks under the directory, and excludes modules found there as a part of the distribution, at the cost of extra dependencies for those private modules.
- recommends, suggests, develop
Set these to test more extensively.
If you pass an optional CPAN::Common::Index instance (as the second example above), it is used to find a distribution that contains a
usedmodule. The test for the module passes if one of the modules that the distribution contains is listed in the cpanfile, even when the
usedmodule itself is not listed.
Kenichi Ishigaki, <email@example.com>
This software is copyright (c) 2017 by Kenichi Ishigaki.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Test::CPANfile, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Test::CPANfile
For more information on module installation, please visit the detailed CPAN module installation guide.