Module::Finder - find and query modules in @INC and/or elsewhere
use Module::Finder; my $finder = Module::Finder->new( dirs => ['/usr/local/junk/', '/junk/', @INC], paths => { 'Module::Name::Prefix' => '-', # no recursion - just *.pm 'This::Path' => '-/-', # only This/Path/*/*.pm 'My' => '*', # everything below My/ }, ); # dirs searches @INC only if it is blank # the first request will cache search results my @modnames = $finder->modules; my @modinfos = $finder->module_infos; my $info = $finder->module_info('My::Found'); # if you're creating/installing code, you might want to rescan $finder->reset;
my $finder = Module::Finder->new(%args);
This isn't the same as shell glob syntax. These globs say how deep (or not) you want to look in a given path and whether you want to pickup modules that appear along the way. A list of shell glob equivalents follows each one.
/ just recurse (*, */*, */*/*, ...) + just this directory (*) -/+ only one level down (*/*) -/-/+ two levels down (*/*/*) -/+/+ one and two levels down (*/*, */*/*) +/+/+ zero thru two levels down (*, */*, */*/*)
If the glob spec is more that just "+", the trailing plus (which is required to make sense) may be omitted (e.g. '-/+' and '-/' are equivalent.)
$finder->_find;
my @dirs = $self->_which_dirs;
my $glob = $self->_glob_parse($glob);
$finder->reset;
my @modnames = $finder->modules;
Returns the info for the first hit of every found module.
my %modinfos = $finder->module_infos;
Returns the info for all hits of every found module. Each element of the returned hash will be an array ref with one or more info objects.
my %modinfos = $finder->all_module_infos;
my $info = $finder->module_info('My::Found');
my @info = $finder->all_module_info('My::Found');
Eric Wilhelm <ewilhelm at cpan dot org>
http://scratchcomputing.com/
If you found this module on CPAN, please report any bugs or feature requests through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
If you pulled this development version from my /svn/, please contact me directly.
Copyright (C) 2006 Eric L. Wilhelm, All Rights Reserved.
Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatseover. You have been warned.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This module is inspired and/or informed by the following. Maybe they do what you want.
File::Find File::Finder Module::Find Module::Require Module::Locate Module::Pluggable::Object Module::List
To install Module::Finder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::Finder
CPAN shell
perl -MCPAN -e shell install Module::Finder
For more information on module installation, please visit the detailed CPAN module installation guide.