Module::Find - Search @INC for libraries without loading them
use Module::Find qw(find_module); # find the first CGI.pm my $location = find_module( "CGI" ); # find all of them my @loactions = find_module( "CGI" ); # find module directories my @directories = find_module_dirs( "Test" ); # find modules under a namespace my @modules = find_modules_under( "Test" );
Module::Find goes through the directories in @INC and finds the occurances of the named module or library. It can return the first location it finds or all the location it finds. It does not attempt to load the modules.
Given MODULE, return a list of all of its installed locations under the directories in ARRAY (or @INC by default). In scalar context it returns the first installed location, which should be the same one that perl finds first.
Given NAMESPACE (not necessarily a complete module name), find all directories under those in ARRAY (or @INC by default ) that contain that namespace. It returns a list of directory names.
Like find_module_dirs, but returns all of the modules under the same directories. It returns a list of module names (i.e. Foo::Bar).
For instance, if I wanted to find all the modules under the Module::Release namespace (so I could load them all), I could:
foreach my $module ( find_modules_under( "Module::Release" ) ) { require $module; }
This source is part of a SourceForge project which always has the latest sources in CVS, as well as all of the previous releases.
http://sourceforge.net/projects/brian-d-foy/
If, for some reason, I disappear from the world, one of the other members of the project can shepherd this module appropriately.
brian d foy, <bdfoy@cpan.org>
Copyright (c) 2004 brian d foy. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Module::Find, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::Find
CPAN shell
perl -MCPAN -e shell install Module::Find
For more information on module installation, please visit the detailed CPAN module installation guide.