in reply to Re^2: Turning on regexp debugging at runtime
in thread Turning on regexp debugging at runtime
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).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Turning on regexp debugging at runtime
by Anonymous Monk on Sep 23, 2014 at 16:29 UTC | |
by SBECK (Chaplain) on Sep 23, 2014 at 17:11 UTC | |
by FloydATC (Deacon) on Sep 24, 2014 at 11:32 UTC | |
by RonW (Parson) on Sep 24, 2014 at 16:35 UTC | |
by choroba (Cardinal) on Sep 24, 2014 at 17:03 UTC | |
|
Re^4: Turning on regexp debugging at runtime
by Monk::Thomas (Friar) on Sep 24, 2014 at 14:00 UTC | |
by SBECK (Chaplain) on Sep 24, 2014 at 17:34 UTC | |
by roboticus (Chancellor) on Sep 24, 2014 at 20:28 UTC | |
by Monk::Thomas (Friar) on Sep 25, 2014 at 07:43 UTC |