[sf-perl] Debugger goodness
Paul Makepeace
london.pm.org at paulm.com
Wed Mar 1 20:18:02 GMT 2006
Forwarding onto London.pm - thanks David!
Je 2006-03-01 19:56:00 +0000, David Alban skribis:
> Greetings,
>
> In the spirit of last night's discussion, I'd like to offer some perl
> debugger goodies. These are documented, but if you use the debugger
> and you don't know about them, the cause of Badness in the Universe is
> strengthened (and a kitten is probably killed).
>
> The first goodie is the ability to page debugger output. Use of the
> pipe character ('|') before a debugger command achieves this. E.g.:
>
> DB<1> |x $foo
>
> The pipe character causes the debugger to pipe the output through a
> pager. So if you have a variable that creates pages and pages and
> pages of output with the debugger's 'x' command, you can page that
> output. Or if you want to page something that's very complicated. I
> use less(1) as my pager, so not only can I page the output, but I can
> operate on it in any way that less allows, like piping it through
> another command (think shell command, not debugger command) or like
> saving it to a file for further study/preservation.
>
> >From perldebug:
>
> Configurable Options
>
> The debugger has numerous options settable using the "o"
> command, either interactively or from the environment or an
> rc file. (./.perldb or ~/.perldb under Unix.)
>
> [...]
>
> "pager" Program to use for output of pager-piped
> commands (those beginning with a "|" character.)
> By default, $ENV{PAGER} will be used. Because
> the debugger uses your current terminal
> characteristics for bold and underlining, if the
> chosen pager does not pass escape sequences
> through unchanged, the output of some debugger
> commands will not be readable when sent through
> the pager.
>
> Another debugger goodie is the ability to run shell commands from
> within the debugger:
>
> DB<2> !!date
> Wed Mar 1 11:18:45 PST 2006
>
> by preceding them with "!!". Sure you could run them in a different
> window, but the option to run them in the debugger session is there.
>
> Another goodie: gnu readline support. In my shell environment I have:
>
> export EDITOR=vim
>
> And executing 'o Readline?' in the debugger shows the value for the
> Readline option is 1. As a result, the debugger command line is a one
> line vim window (similar to the effect on the command line of
> "set -o vi" in ksh or bash). That is, I can use vim commands to do
> debugger command history recall and debugger command line editing.
> I'm assuming the debugger would do the right thing for:
>
> export EDITOR=emacs
>
> A prerequisite for this, however, is that you install Term::ReadKey
> and Term::ReadLine from CPAN. Curiously, the perldebug man page says:
>
> These do not support normal vi command-line editing, however.
>
> But I get normal vi(m) command line editing. Strange...
>
> The perl debugger kicks serious boo-tay, and is essential to my
> personal "ide" (bash/vim/perl debugger/RCS/perldoc).
>
> David
>
> P.S. The other day I stumbled across wikipedia's metasyntactic
> variable page (http://en.wikipedia.org/wiki/Metasyntactic_variable).
> That's what foo, bar, bat, baz, etc. are called. Very entertaining
> page. I encourage Joe to add Garbagio::Fantastico to the page. :-D
> --
> Live in a world of your own, but always welcome visitors.
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
--
Paul Makepeace .............................. http://paulm.com/inchoate/
"If cabbage is cozy, then your body is a walking corpse stuffed with
pills and receipts."
-- http://paulm.com/toys/surrealism/
More information about the london.pm
mailing list