Perhaps:
package reload; use strict; use warnings; sub reload { my ($PM) = @_ or return; $PM =~ s!::!/!g; $PM .= ".pm"; delete $INC{$PM}; no strict 'refs'; no warnings 'redefine'; my $warnings = \&warnings::import; local *warnings::import = sub { &{$warnings}; unimport warnings "redefine"; }; eval { require $PM }; } 1;
It should still work as before except it won't spew out redefine errors.
In reply to Re: Reloading modules- suppressing warnings works sometimes?
by !1
in thread Reloading modules- suppressing warnings works sometimes?
by JPaul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |