Thanks for both of these replies, especially the second since I wasn't aware of the DEBUG_REGEX environment variable.
I should have been a bit clearer, but it appears that what I want to do probably can't be done. For example, say I have the absurdly simple script:
$re1 = qr/a/;
$re2 = qr/b/;
$re3 = qr/c/;
$str = "ab";
$str =~ $re1;
$str =~ $re2;
$str =~ $re3;
what I want to do is step through the code (in the debugger) and turn on debugging (by executing "use re 'debug'") when I match against $re2 but then turn it back off before proceeding to the $re3 match.
I could put each in it's own scope, but that would be messy (I don't really want to put every regexp in it's own scope so that I could potentially debug it individually).
Even worse is that the regexps in question were built outside of the scope, so I actually end up with something more similar to this:
$str = "abc";
$re1 = qr/a/;
$re2 = qr/b/;
{
use re 'debug';
$str =~ $re1;
{
no re 'debug';
$str =~ $re2;
}
}
which won't print any debugging info at all.
Oh well, I can do what I've always done (temporarily enable debugging and then go to the point in the code I'm interested in ignoring all the unwanted debugging output).
|