Out of curiosity I hacked something up for you:
{ my %orig; sub re_db_on (\$) { my ($r) = @_; die "not a regex" unless ref $$r eq 'Regexp'; return if $orig{$r}; $orig{$r} = $$r; # note this depends on the proper stringification of the regex $$r = eval qq{ use re qw/Debug EXECUTE/; qr/$$r/ }; } sub re_db_off (\$) { my ($r) = @_; return unless $orig{$r}; $$r = delete $orig{$r}; } } my $ra = qr/a/; my $rb = qr/b/; my $rc = qr/c/; my $str = "abc"; $,=", "; $\="\n"; print $str=~$ra, $str=~$rb, $str=~$rc; re_db_on $rb; print $str=~$ra, $str=~$rb, $str=~$rc; re_db_off $rb; print $str=~$ra, $str=~$rb, $str=~$rc;
Tested on v5.20 / Linux. The subs work when called from the debugger too.
In reply to Re: Turning on regexp debugging at runtime
by Anonymous Monk
in thread Turning on regexp debugging at runtime
by SBECK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |