Skip Menu |

This queue is for tickets about the Module-Pluggable CPAN distribution.

Report information
The Basics
Id: 38468
Status: resolved
Priority: 0/
Queue: Module-Pluggable

People
Owner: Nobody in particular
Requestors: TIMBRODY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Don't carp() on require failure
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)
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?
Released as 4.1