Of course (Doh!) once I know the line where the program is failing, I can set a break in the previous executable line, and if it's the first line in a sub, set a break on the sub.
This has given me enough information for a bug report for the original problem I had, but I could imagine there might be some problems if the code is inside a coderef and/or an eval (yes, I do do tortuous things with coderefs sometimes as fever knows :-).
However, I still think that the debugger could benefit from a better handler to catch $SIG{__DIE__}, enabling you to look at lexical variables in scope at the point where it dies, and the good ol' stack trace. Where or to whom do I post such a suggestion?
Also, I could use (and I am thinking of writing when I get a round tuit) a generic script called confessor.pl, which takes a script and argv list, sets up the die handler which will confess, then requires in the script. I have had a brief stab at this, but there are issues with BEGIN code, and the scripts are not designed to be 'require'd so they do not return true.
Update: Maybe a form of use Carp qw(verbose); should catch $SIG{__DIE__}. Possibly use Carp qw(verbose,catchdie);
Update 2: Just tried the suggestion use diagnostics; or rather perl -Mdiagnostics foobar.pl from anonymonk below. It does the business! Anonymonk++ whoever you are! Sign up to the monastery with an ID, your input is most welcome.
In reply to Re: How do I get a post mortem stack trace?
by rinceWind
in thread How do I get a post mortem stack trace?
by rinceWind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |