Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: [perldebugger] calling perldoc from within the debugger

by broomduster (Priest)
on Aug 06, 2009 at 13:06 UTC ( #786412=note: print w/replies, xml ) Need Help??

in reply to [perldebugger] calling perldoc from within the debugger

Does $DB::doccmd='perldoc' do what you want? Seems to work OK for me with 5.10.0:
-> perl -de0 main::(-e:1): 0 DB<1> $DB::doccmd='perldoc' DB<2> perldoc -f grep
shows me the usual perldoc -f grep output

Replies are listed 'Best First'.
Re^2: [perldebugger] calling perldoc from within the debugger (inifile)
by LanX (Cardinal) on Aug 06, 2009 at 13:26 UTC

    And I just figured out how to preset aliases at startup.

    There is a ini-file called .perldb sourced!

    lanx@nc10-ubuntu:~$ cat .perldb sub afterinit { $DB::alias{ALIAS}='s/ALIAS/command/' }

    so with your approach I may write

    sub afterinit { $DB::doccmd='perldoc'; $DB::alias{doc}='s/doc/perldoc/'; }

    so now I can type:

    DB<2> doc -f print

    and get better results...

    ... now I just have to figure out the best way to call a shellscript called doc, such that I have the same syntax from shellprompt (and than I can enrich the features of perldoc for my needs 8)

    lanx@nc10-ubuntu:~$ doc -k '=='

    Cheers Rolf

      You might look at Devel::Command, which I wrote when I needed to add commands to the debugger.

      It's a bit of a hack, as it has to monkeypatch DB::DB with a version that has a Module::Pluggable command loader. A very small command module that just system()s the shell command you want may do it.

        Nice really nice! 8)

        But actually I'm using the debugger just as a REPL (without the P) and never for debugging, don't you think that my small alias solution is just appropriate? I'm not sure if I'm going to system the script or better avoid forking by useing it as a module.

        Anyway if your a debugger expert, do you know how I can configure that the returnvalue of each eval ist printed with x, such that I get a full REPL out of it?

        (see also using perldebugger as REPL?)

        Cheers Rolf

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://786412]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2020-11-30 06:06 GMT
Find Nodes?
    Voting Booth?

    No recent polls found