Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
The stupid question is the question not asked
 
PerlMonks  

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


Comment on Re: [perldebugger] calling perldoc from within the debugger
Select or Download Code
Re^2: [perldebugger] calling perldoc from within the debugger (inifile)
by LanX (Abbot) on Aug 06, 2009 at 13:26 UTC
    Thanks!

    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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2014-04-16 11:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (424 votes), past polls