Subject: | Please allow require-or-die semantics |
Hi there,
often I use Module::Pluggable, or my own wrapping around it,
Module::PluginFinder, to easily support extensions to programs. I find
the following pattern keeps coming up:
use Module::Pluggable sub_name => "net_types",
search_path => [ "Circle::Net" ];
{
foreach my $class ( net_types ) {
( my $file = "$class.pm" ) =~ s{::}{/}g;
require $file;
}
}
The problem is that if I just use the 'require => 1' option to
Module::Pluggable, it tries its best to load all the plugins, skipping
over the ones it couldn't load. Sometimes I want the behaviour that any
error should be fatal. Perhaps there could be an option to die fatally
on the first require failure by
use Module::Pluggable require_or_die => 1,...
or some-such option name?
--
Paul Evans