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

Hi

I can see that perldoc tst prefers to render /tmp/tst.pod instead of /tmp/tst.pl after setting export PERL5LIB="/tmp" ¹.

Thats great!

But can I make it work like this w/o explicitly setting PERL5LIB?

lanx:~$ unset PERL5LIB lanx:~$ perldoc /tmp/tst No documentation found for "/tmp/tst".

Kind of "redirection" in tst.pl?

Cheers Rolf

¹)update: or PATH

Replies are listed 'Best First'.
Re: How perldoc chooses PODs' path
by Khen1950fx (Canon) on Mar 01, 2012 at 20:23 UTC
    You could use Pod::Autopod to make your /tmp/tst. Autopod will print .pod if it finds .pm, etc. Just make tst.pl without the .pl. Then just do perldoc /tmp/tst. It should print without .pod.
      Great, that's pretty close to what I'm trying to "reinvent"! :)

      Cheers Rolf

Re: How perldoc chooses PODs' path
by tchrist (Pilgrim) on Mar 01, 2012 at 22:16 UTC
    Why don’t you just call pod2text directly? That way you know exactly what it’s doing.
      Sure I can do whatever I want. :)

      The idea is that for end users file.pod has priority over file.pl or file.pm.

      Like that file.pod can be flexibly generated out of (pseudo-)POD directives in file.pl

      Motivation:

      There is a long going discussion if POD should be inter-weaved with code or not, with good arguments for both sides.

      For instance the order of subroutines/methods in the source isn't necessarily the best order for documentation.

      And "private" subs shouldn't be documented at all.

      Generating file.pod in a way reflecting these needs could be a handy solution, w/o forcing anybody to use anything else than classical perlpod.

      Cheers Rolf

        Generating file.pod in a way reflecting these needs could be a handy solution, w/o forcing anybody to use anything else than classical perlpod.
        I’m afraid you’ve lost me there. I suppose I do occasionally use pod2text, usually on a exact pathname, sometimes in conjunction with pmpath to find a module path. Isn’t pod2text the classic program here? Why bother with anything else?

        I honestly can’t think of any reason (apart from being trapped on Windows, I suppose) why anyone would use anything but the normal man program for reading Perl documentation. Occasionally I create PDF or HTML, but those are pretty special-purposed.

        I have a bunch of little tools for dealing with modules and with pod. Here’s a partial list: balance-angles, balance-braces, balance-brackets, balance-parens, balanced, basepods, catpod, catpodidx, faqpods, fmtpara, idxspell, modpods, okpod, ora2pod, orphanX, pmall, pmcat, pmdesc, pmdirs, pmeter, pmeth, pmexp, pmfunc, pminst, pmload, pmls, pmman, pmpath, pmvers, pod2docbook, pod2ora, podcode, podgrep, podpath, pods, podtoc, shflpod, sitepods, splitpod, stdpods, testpod, uniwc, xfootnotes, and xpod — just to name a few.

        Here’s an illustration of the way I mix and match just a few of the more frequently used ones:

        But for just reading things, I always use pod2text on uninstalled things and man on installed things. Anything else just gets in my way — but your mileage may vary, especially if you’ve been metricated. 😈