From: jl_post on
Hi,

I use the perldocs frequently when I'm programming in Perl.
However, on some systems I've used, "perldoc" is apparently not
installed (despite the fact that Perl is). What I'd like is a way to
cleanly extract the perldoc documentation from a module that is
installed on that system. (For example, I'd like to view the
documentation that I'd normally see with "perldoc Time::Local" on a
system that unfortunately doesn't have "perldoc" installed.)

I know that I can go to cpan.org and look up the documentation, but
sometimes I'm working on a system cut off from the internet. Just
extracting the perl documentation from an already installed module
doesn't seem to me to be a very complex issue (although maybe I'm
wrong).

So what I'm asking is: Is there a pure-Perl way to view a module's
perldoc documentation, particularly if the "perldoc" package is not
installed (and I have no power to install it)?

Thanks.

-- Jean-Luc
From: John Bokma on
"jl_post(a)hotmail.com" <jl_post(a)hotmail.com> writes:

> So what I'm asking is: Is there a pure-Perl way to view a module's
> perldoc documentation, particularly if the "perldoc" package is not
> installed (and I have no power to install it)?

perldoc *is* pure Perl.

Install Pod::Perldoc and locally [1], it comes with perldoc.
Just set a path to it, or:

perl -MPod::Perldoc -e'Pod::Perldoc->run()' Time::Local

perldoc -q 'own module'

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
From: jl_post on
> "jl_p...(a)hotmail.com" <jl_p...(a)hotmail.com> asked:
> >    So what I'm asking is:  Is there a pure-Perl way to view
> > a module's perldoc documentation, particularly if the
> > "perldoc" package is not installed (and I have no power to
> > install it)?
>
> perldoc *is* pure Perl.


On Mar 4, 12:44 pm, John Bokma <j...(a)castleamber.com> replied:
>
> Install Pod::Perldoc and locally [1], it comes with perldoc.
> Just set a path to it, or:
>
> perl -MPod::Perldoc -e'Pod::Perldoc->run()' Time::Local


Excellent! I just tried that one command on one system that
doesn't have "perldoc" installed, and the perldoc documentation for
Time::Local appeared! (So ironically Pod::Perldoc is apparently
already installed, even though the "perldoc" package is not.)

It even works for regular perldoc pages, like "perlpacktut", like
this:

perl -MPod::Perldoc -e "Pod::Perldoc->run()" perlpacktut

If I want to look up a core function, like split(), I can't figure
out how to emulate "perldoc -f split", but I CAN do:

perl -MPod::Perldoc -e "Pod::Perldoc->run()" perlfunc

and look it up from there. However, I still can't figure out how to
do things like "perldoc -q 'own module'". (I'd read through the
"perldoc Pod::Perldoc" documentation, but apparently there isn't
any...)

Anyway, John, your solution goes above and beyond what I was hoping
for. (Now I just need to commit it to memory for those times when I
can't look it up.)

Thanks again!

-- Jean-Luc
From: Ben Morrow on

Quoth "jl_post(a)hotmail.com" <jl_post(a)hotmail.com>:
> > "jl_p...(a)hotmail.com" <jl_p...(a)hotmail.com> asked:
> > > � �So what I'm asking is: �Is there a pure-Perl way to view
> > > a module's perldoc documentation, particularly if the
> > > "perldoc" package is not installed (and I have no power to
> > > install it)?
> >
> > perldoc *is* pure Perl.
>
>
> On Mar 4, 12:44�pm, John Bokma <j...(a)castleamber.com> replied:
> >
> > Install Pod::Perldoc and locally [1], it comes with perldoc.
> > Just set a path to it, or:
> >
> > perl -MPod::Perldoc -e'Pod::Perldoc->run()' Time::Local
>
>
> Excellent! I just tried that one command on one system that
> doesn't have "perldoc" installed, and the perldoc documentation for
> Time::Local appeared! (So ironically Pod::Perldoc is apparently
> already installed, even though the "perldoc" package is not.)

perldoc almost certainly *is* installed somewhere, it's just not in your
PATH. Check to see if your /usr/bin/perl is a symlink somewhere, and if
the real binary has a 'perldoc' next to it.

OTOH, the 'perldoc' script looks like:

| #!/usr/bin/perl
| eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
| if 0;
|
| # This "perldoc" file was generated by "perldoc.PL"
|
| require 5;
| BEGIN { $^W = 1 if $ENV{'PERLDOCDEBUG'} }
| use Pod::Perldoc;
| exit( Pod::Perldoc->run() );

so you could just put that in a file called 'perldoc' somewhere in your
PATH (fix the #! line first, obviously).

> It even works for regular perldoc pages, like "perlpacktut", like
>
> perl -MPod::Perldoc -e "Pod::Perldoc->run()" perlpacktut
>
> If I want to look up a core function, like split(), I can't figure
> out how to emulate "perldoc -f split", but I CAN do:
>
> perl -MPod::Perldoc -e "Pod::Perldoc->run()" perlfunc
>
> and look it up from there. However, I still can't figure out how to
> do things like "perldoc -q 'own module'". (I'd read through the
> "perldoc Pod::Perldoc" documentation, but apparently there isn't
> any...)

You need an extra '--', to separate the args for perl and the args for
Perl. This is documented in perlrun.

perl -MPod::Perldoc -e'Pod::Perldoc->run' -- -f split

Ben

From: J�rgen Exner on
"jl_post(a)hotmail.com" <jl_post(a)hotmail.com> wrote:
> I use the perldocs frequently when I'm programming in Perl.
>However, on some systems I've used, "perldoc" is apparently not
>installed (despite the fact that Perl is).

Then you may want to kick the administrator until he fixes the broken
installation.

jue