in reply to How can two modules latch onto $SIN{__WARN__} or $SIG{__DIE__}?

Are they trying to rethrow the die? And then you catch it again. Try this:
if ($SIG{__WARN__}) { my $previous = $SIG{__WARN__}; my $caught = 0; $SIG{__WARN__} = sub { return if $caught; $caught = 1; # do my stuff my $ret = $previous->(); $caught = 0; return $ret; }; } else
If they catch the fact that you are in the call stack you might want to leave the goto in, but then you are limiting them to one warning in the entire script.

UPDATE
Oops. I forgot to call the ref. :-(

Worse than that, the solution is too complex and misses the cause of the problem. See the response I have down below. Just drop the goto and the original code works.

  • Comment on Re (tilly) 1: How can two modules latch onto $SIN{__WARN__} or $SIG{__DIE__}?
  • Download Code

Replies are listed 'Best First'.
Re (tilly) 1: How can two modules latch onto $SIN{__WARN__} or $SIG{__DIE__}?
by rrwo (Friar) on Jan 10, 2001 at 08:08 UTC

    This is confusing: what's going on? The signal handler must return a subroutine/coderef to go to after it's done?

    Where is this documented?

      Oops, it is late and I am tired.

      I just wanted to call and then return the return from that handler. I didn't want to return the reference itself without calling it.

      Anyways your problem is that you are editing the fact that the signal has been handled out of the call stack, so when it is rethrown you are called again.

      Actually just drop the goto and your code should work.