http://qs1969.pair.com?node_id=460492


in reply to Interactive scripting with debugger

There's sure no better way to "become one" with a program, putting yourself "in its shoes" than running it inside an interactive debugger.

You might also like these tips and tricks;

$h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";

Replies are listed 'Best First'.
Re^2: Interactive scripting with DB
by tlm (Prior) on May 26, 2005 at 03:42 UTC

    Putting the line kill 2, $$ will cause the debugger to break at that point in the source (on Unix, anyway).

    I had never seen that trick before. Cool. I have been using this one instead:

    $DB::single = 1;
    That causes the debugger to enter "single-step" mode, which amounts to programmatically setting a breakpoint in the next executable line. This is particularly useful for causing the debugger to stop at places that happen before the first executable line, e.g.:
    BEGIN { $DB::single = 1; } use Foo;
    The code above will enable stepping through the loading of 'Foo', which otherwise would happen before the place at which DB normally starts (i.e. the first executable line). I see that kill 2, $$ works well for this too. One more trick for the bag.

    the lowliest monk