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;
This module tests if cpanfile lists every used modules or not.
use
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 recommends or suggests.
eval
requires
recommends
suggests
You can pass an optional hash, which is passed to Perl::PrereqScanner::NotQuiteLite::App's constructor to change its behavior.
If you pass an optional CPAN::Common::Index instance (as the second example above), it is used to find a distribution that contains a used module. The test for the module passes if one of the modules that the distribution contains is listed in the cpanfile, even when the used module itself is not listed.
used
Perl::PrereqScanner::NotQuiteLite, CPAN::Common::Index
Kenichi Ishigaki, <ishigaki@cpan.org>
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.
To install Test::CPANfile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::CPANfile
CPAN shell
perl -MCPAN -e shell install Test::CPANfile
For more information on module installation, please visit the detailed CPAN module installation guide.