http://www.perlmonks.org?node_id=1065500

rockyb has asked for the wisdom of the Perl Monks concerning the following question:

In the Devel::Trepan debugger (or possibly other debuggers), the debugger fakes up the environment before calling eval() to show values of expressions that a user might try. Specifically, Devel::Trepan fakes the values of @_, __FILE__, __LINE__ to reflect the values in the debugged program rather than the real current values inside the debugger environment.

What I'd like to do is replace CORE::caller() or just caller() inside the eval with my own custom routine which will pop off the top calls from inside the debugger.

Of course, it would be good to restore those values after the eval() although I suppose my custom one could work all the time doing essentially nothing when not in the debugger.

Any thoughts?

Thanks.