LanX has asked for the wisdom of the Perl Monks concerning the following question:
I'm interested to interactively deactivate a bunch debugger commands like { - at least temporarily.
Is there a recommended way, except patching perl5db.pl and pointing the environment to the patch?
My motivation is to use the debugger as a REPL to automatically print evaluated values.
But many perldebug#Debugger-Commands only make sense when used while debugging
DB<50> h List/search source lines: Control script execution: l [ln|sub] List source code T Stack trace - or . List previous/current line s [expr] Single step [in +expr] v [line] View around line n [expr] Next, steps over + subs ... yadda yadda
and such pure debugger commands like { and [ at first position are interfering with Perl's syntax, such that
DB<1> { a => 1 } # not an anonym hash DB<2> { pre-debugger commands: { -- a => 1 } DB<2>
So my idea was using aliases to deactivate them, it works but runs into a a missing quotemeta bug in the debugger
DB<1> = { ;{ Unescaped left brace in regex is deprecated, passed through in regex; +marked by <-- HERE in m/s\a{ <-- HERE \a(.*)\a$/ at C:/Perl_524/lib/p +erl5db.pl line 3826. at C:/Perl_524/lib/perl5db.pl line 3826. DB::Obj::_handle_equal_sign_command(DB::Obj=HASH(0x24de098)) c +alled at C:/Perl_524/lib/perl5db.pl line 2881 DB::DB called at -e line 1 { = ;{ DB<2> { a => 1 } DB<3> { Missing right curly or square bracket at (eval 14)[C:/Perl_524/lib/per +l5db.pl:737] line 3, at end of line syntax error at (eval 14)[C:/Perl_524/lib/perl5db.pl:737] line 3, at E +OF DB<3>
My bigger concern is that defining dozens of "pseudo aliases" makes listing the user defined aliases with = unreadable.
DB<6> h = = [alias value] Define a command alias, or list current aliases. DB<7>
FWIW: I could use PadWalker to access the lexical hashes defining/dispatching the commands, but this is even messier.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
|---|