Subject: | [patch] trap fatal error: Can't undef active subroutine at /usr/share/perl5/Module/Refresh.pm line 154. |
I'm using Module::Refresh under HTML::Mason (1.30) / mod_perl (1.29) on Debian unstable.
Without this patch, I was getting a fatal error:
Can't undef active subroutine at /usr/share/perl5/Module/Refresh.pm line 154.
This patch changes this to a warning and adds the name of the subroutine that triggered it. I now get the non-fatal warning:
HTML::Mason::handler: Can't undef active subroutine at /usr/share/perl5/Module/Refresh.pm line 154.
Perhaps I wedged Module::Refresh in my Mason handler.pl incorrectly, but it otherwise seems to work with the patch and it does still throw a warning, so...
--- Refresh.pm-0.06 2005-10-02 04:08:31.000000000 -0700
+++ Refresh.pm 2005-10-02 04:28:50.000000000 -0700
@@ -151,7 +151,8 @@
grep { index( $DB::sub{$_}, "$file:" ) == 0 } keys %DB::sub
) {
warn "Deleting $sym from $file" if ($sym =~ /freeze/);
- undef &$sym;
+ eval { undef &$sym };
+ warn "$sym: $@" if $@;
delete $DB::sub{$sym};
}