Test::UsedModules - Detects needless modules which are being used in your module
This document describes Test::UsedModules version 0.03
# check all of modules that are listed in MANIFEST use Test::More; use Test::UsedModules; all_used_modules_ok(); done_testing; # you can also specify individual file use Test::More; use Test::UsedModules; used_modules_ok('/path/to/your/module_or_script'); done_testing;
Test::UsedModules finds needless modules which are being used in your module to clean up the source code. Used modules (it means modules are used by 'use', 'require' or 'load (from Module::Load)' in target) will be checked by this module.
all_used_modules_ok
This is a test function which finds needless used modules from modules that are listed in MANIFEST file.
used_modules_ok
This is a test function which finds needless used modules from specified source code. This function requires an argument which is the path to source file.
PPI (version 1.215 or later)
Test::Builder::Module (version 0.98 or later)
Cannot detects rightly when target module applies monkey patch.
e.g. HTTP::Message::PSGI
It applies monkey patch to HTTP::Request and HTTP::Response.
Cannot detects when target module is used by `Module::Load::load` and module name is substituted in variable.
e.g.
use Module::Load; my $module = 'Foo::Bar'; load $module;
in this case, Test::UsedModules will not notify even if Foo::Bar has never been used.
Copyright (C) moznion.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
moznion <moznion@gmail.com>
To install Test::UsedModules, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::UsedModules
CPAN shell
perl -MCPAN -e shell install Test::UsedModules
For more information on module installation, please visit the detailed CPAN module installation guide.