in reply to Re^3: Turning on regexp debugging at runtime
in thread Turning on regexp debugging at runtime
The name DEBUG_REGEX is made up, and can be anything (note the test of $ENV{DEBUG_REGEX} in the code).
How about:
my $re1 = qr/a/; my $re2 = do { use if $ENV{FOO_DEBUG_REGEX}, qw/re Debug EXECUTE/; qr/b/ }; my $re3 = qr/c/; my $str = "ab"; $str =~ $re1; $str =~ $re2; $str =~ $re3;
will output run-time debug info on $re2 only when the environment var FOO_DEBUG_REGEX is set.
I'm not sure if this can be done dynamically in the debugger, perhaps another monk with more experience there can help. The documentation does say that use re 'debug'; has both compile-time and run-time effects.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Turning on regexp debugging at runtime
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 |
In Section
Seekers of Perl Wisdom