Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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 (Chancellor) 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]
[Corion]: ambrus: Oh - that one would be much harder to automate... The SYNOPSIS section should mostly be a runnable program IMO, but I write only small snippets in my documentation for single functions/methods, and creating the appropriate environment for ...
[Corion]: ... those in an automated fashion seems somewhat hard to me. Although it should do wonders for the test coverage ;)
[haukex]: Corion: I once wrote an automated thingy for that here
[haukex]: here's the code that uses it
[Corion]: haukex: Hmm - maybe I can reuse that. I see that it uses Pod::Parser, which I think was one of the more fragile parsers. But if I'm statically (re)generating the tests instead of doing that "live" on the client/tester machines, that's a much smaller...
[Corion]: ... problem space than trying to cater to all versions of Pod::Parser(s)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2017-02-27 12:20 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (385 votes). Check out past polls.