On Fri, 12 Jun 2009, Richard Jones wrote:
Can Module::Pluggable be used as an alternative to Module::Find? I load all
my Model::DB classes up front in a BEGIN block in MyApp::Base, like this:
BEGIN {
use Module::Find;
Module::Find::setmoduledirs('path/to/lib');
Module::Find::useall MyApp::DB;
}
use Module::Pluggable
require => 1,
search_dirs => [ 'path/to/lib/MyApp/DB' ]
For this to work I need the Module::Pluggable equivalent of useall().
Does this (from the docs) do the trick?
<quote>
Or if you want to instantiate each plugin rather than just return the
name
package MyClass;
use Module::Pluggable instantiate => 'new';
and then
# whatever is passed to 'plugins' will be passed
# to 'new' for each plugin
my @plugins = $mc->plugins(@options);
</quote>
For non object-oriented modules you could combine require and instantiate
=> import for an equivalent to use.
--
Jaldhar H. Vyas <[email protected]>
##### CGI::Application community mailing list ################
## ##
## To unsubscribe, or change your message delivery options, ##
## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ##
## ##
## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ##
## Wiki: http://cgiapp.erlbaum.net/ ##
## ##
################################################################