At 07:31 AM 6/7/02 -0500, David T-G wrote:
>The recent post containing print statements "this is one" and so on
>reminded me of an old question that I've never had answered: what's a
>good way to trace your program as it runs, preferably without getting
>into the debugger?

You have to use the/a debugger.

>I realize that that's sort of a loaded question and that the obvious right
>answer, promoted by power perlers everywhere, is to use the debugger.
>But I don't know how to use the sucker, haven't gotten far learning it
>(and my forehead now hurts from all of the banging), and all I really
>want is the equivalent of "set -x" under sh so that I can see the steps
>that were taken and follow the progress in the output.

It won't show the values of any variables, only the lines of code being 
executed.  Which in any Perl program worth its salt are generally too 
numerous to want to do this.

However, you can show a subset if you want.  I show one example on 
<PLUG>page 119 of my book "Perl Debugged", which, amazingly enough, is 
about debugging Perl programs:

while (<INPUT>) {
   $DB::trace = 1, next if /debug/;
   $DB::trace = 0, next if /nodebug/;
   # more code
}
</PLUG>

But you can get started by typing

         t
         c

at a debugger prompt and see what happens.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to