in reply to Capturing stack trace in eval

You can override CORE::GLOBAL::die to throw an exception object (see the die documentation) which captures the call stack at that moment, instead of just a string.

Which is the only reliable way I've found to do it.

edit: don't try to use the $SIG{__DIE__} for this. It won't work.