in reply to Re: How can I print variable contents from the debugger non-interactively?
in thread How can I print variable contents from the debugger non-interactively?

Marshall thank you for your reply, additional description for why one might want to debug the script without modifying it has been provided in the orginal question.

Maybe you can find all kinds of tricky debug statements to get the debugger to do what you want right now. However, you will not know that stuff years from now when you are debugging some modification.

I don't agree with this sentiment, I think learning to use the debugger and understanding how to use it to print and maybe even modify runtime behavior of the script without modification is a skill that could be useful years from now (i have a good memory and places to document the perl wisdom gleaned from this question/responses). Using print/debug statements is easy and effective, but I'm looking to further my understanding of basic perl tools and add to perl repertoire.
  • Comment on Re^2: How can I print variable contents from the debugger non-interactively?

Replies are listed 'Best First'.
Re^3: How can I print variable contents from the debugger non-interactively?
by Marshall (Canon) on Jul 19, 2017 at 00:51 UTC
    Hi Dave!

    I was thinking of interactive debug commands.

    I believe that you will find in Perl, that the debugger is seldom used because its not required. I have to use a debugger (mandatory) when I write assembly code, I very seldom use a debugger for C code and almost never use a debugger for Perl code - for me, the Perl debugger is a once in a decade event. I have never required the Perl debugger to solve a code problem.

    I congratulate you on your curiosity and motivation to learn more about Perl!

    Perl is an amazingly introspective language. A Perl user function can find out things that are just not possible for a C program.

    Some useful stuff for debugging the caller stack is the Perl Caller() function.

    Some "standard" functions:

    $me = whoami(); $him = whowasi(); sub whoami { (caller(1))[3] } sub whowasi { (caller(2))[3] }
    I recommend study of the caller() function for your "debug repertoire".