Module::Find - Find and use installed modules in acategory |
Module::Find - Find and use installed modules in a (sub)category
use Module::Find;
# use all modules in the Plugins/ directory @found = usesub Mysoft::Plugins;
# use modules in all subdirectories @found = useall Mysoft::Plugins;
# find all DBI::... modules @found = findsubmod DBI;
# find anything in the CGI/ directory @found = findallmod CGI; # set your own search dirs (uses @INC otherwise) setmoduledirs(@INC, @plugindirs, $appdir);
Module::Find lets you find and use modules in categories. This can be very useful for auto-detecting driver or plugin modules. You can differentiate between looking in the category itself or in all subcategories.
If you want Module::Find to search in a certain directory on your
harddisk (such as the plugins directory of your software installation),
make sure you modify @INC
before you call the Module::Find functions.
setmoduledirs(@directories)
@found = findsubmod Module::Category
findsubmod CGI
will return CGI::Session
, but
not CGI::Session::File
.
@found = findallmod Module::Category
findallmod CGI
will return CGI::Session
and also
CGI::Session::File
.
@found = usesub Module::Category
usesub CGI
will return CGI::Session
, but
not CGI::Session::File
.
@found = useall Module::Category
useall CGI
will return CGI::Session
and also
CGI::Session::File
.
Fixed non-platform compatibility by using File::Spec. Thanks to brian d foy.
Added setmoduledirs and updated tests. Idea shamelessly stolen from ...errm... inspired by brian d foy.
Christian Renz, <crenz@web42.com>
Copyright 2004-2008 by Christian Renz <crenz@web42.com>. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module::Find - Find and use installed modules in acategory |