Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Tool for pulling up documentation for individual functions in a module?

by nysus (Parson)
on Apr 14, 2020 at 17:04 UTC ( #11115528=perlquestion: print w/replies, xml ) Need Help??

nysus has asked for the wisdom of the Perl Monks concerning the following question:

perldoc -f works for built-in Perl functions. I'm wondering if there is a tool out there for pulling up a pod entry for a function in my own module. Thanks.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

  • Comment on Tool for pulling up documentation for individual functions in a module?
  • Download Code

Replies are listed 'Best First'.
Re: Tool for pulling up documentation for individual functions in a module?
by haukex (Bishop) on Apr 14, 2020 at 17:30 UTC
    perldoc -f works for built-in Perl functions. I'm wondering if there is a tool out there for pulling up a pod entry for a function in my own module. Thanks.

    perlfunc is treated specially by the tools, it's not a general-purpose solution at work there. Although there is Pod::Select, that's deprecated in the core now, and it seems to me that Pod-Simple doesn't have a direct replacement. A couple of possible solutions are: I haven't tried them, but on CPAN there's Pod::Simple::Select and Pod::Section (sadly, both modules don't appear to have a decent test suite). Lower-level would be to have a look at how the select method in Pod::Usage works (that module could also be used in a hacky solution by redirecting its output), or if you want to write something custom, I've used Pod::Simple::SimpleTree (example).

Re: Tool for pulling up documentation for individual functions in a module?
by choroba (Archbishop) on Apr 14, 2020 at 17:32 UTC
    I use etags (or rather, my own version of it). In Emacs, when I press M-. on a function/package name, it takes me directly to its declaration. Changing it to show the documentation instead should be easy enough.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Haven't used yet but this reminded me that there's a perl lsp server (Perl::LanguageServer). Together with lsp-mode that might be fruitful to look at (not that etags/ctags/GNU global aren't also useful).

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11115528]
Approved by Fletch
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2022-05-16 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (63 votes). Check out past polls.

    Notices?