On Thu Aug 14 04:51:28 2008, TIMBRODY wrote:
Show quoted text> It would be useful to dynamically determine whether to carp() if a
> plugin can't be loaded.
>
> E.g.
>
> use Module::Pluggable on_err => sub {
> my( $class, $fn, $err ) = @_;
> print STDERR "Failed to load module $class ($fn), will not be available
> until you fix the following issue: $err";
> };
>
> (If on_err is defined skip the offending module)
I've just created a new branch called triggers
https://github.com/simonwistow/Module-Pluggable/tree/triggers
that should help with this feature request. Have a look at
https://github.com/simonwistow/Module-Pluggable/blob/triggers/t/22trigger.t
in this case what you'd do is
package MyModule;
use Module::Pluggable require => 1,
on_error => sub { my ($plugin, $error) = @_;
warn "Failed to load module $plugin: '$err'" };
Can you take a look and see if that meets your needs?