How to get pod2usage to pipe into a pager?
HuckinFappy
created: 2006-08-02 15:21:24
I've managed to wrangle my co-workers into using Pod::Usage finally. Now we're starting to get complaints from some users that our help messages dump *too* much information, and they would like it to automatically pipe into a pager.

I know if you run `perldoc $SCRIPT` it will use $PAGER (or $PERLDOC_PAGER, etc...see the perldoc perldoc :) But how to make pod2usage pipe into a pager?

Many thanks, as always,
~Jeff

Re: How to get pod2usage to pipe into a pager?
created: 2006-08-02 15:28:25
See the -output option in the [cpan://Pod::Usage] docs:

-output

    A reference to a filehandle, or the pathname of a file to 
which the usage message should be written. The default is 
\*STDERR unless the exit value is less than 2 (in which case 
the default is \*STDOUT).
Sending the data to STDOUT will allow it to go to the pager. Alternatively, you can redirect STDERR in your shell. E.g. in bash:

your_program.pl 2>&1 | less
Re: How to get pod2usage to pipe into a pager?
created: 2006-08-02 15:29:22

Looking at the documentation, there's an -output option that takes a filehandle to which to write. Try opening a pipe to $ENV{PAGER} || "more" and passing that filehandle to pod2usage.

Re: How to get pod2usage to pipe into a pager?
created: 2006-08-03 00:32:33
Thank you both. I had RTFM, but somehow missed that completely...does anyone have a cloth I can use to wipe this egg off my face? :)

perlmonks.org content © perlmonks.org and Fletch, friedo, HuckinFappy

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03