How to get the Perl debugger to kick in, codewise.

How often do you need to use the perl debugger? Often I presume, either that or you’re a superstar ninja coder or you have no hair left. Anyways, it’s achingly boring trying to step through code and typeing ‘n’ to step into a function when you meant to press ’s’. Well, you could set a breakpoint, but in a loop you’re still going to annoy yourself. A lot.

What you can do is use this:

$DB::single = 1;

CHRIS YOU FOOL! You may cry. That’s no different to setting a debug point anyway. Well, it is if you use your head and Perl’s logic to set it like thus:

while (something_is_happening())
{
$DB::single = 1 if (noises_from_woodshed());

...All your usual gubbins....
}

See, I’m not as silly as I look!