Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

How to get pod2usage to pipe into a pager?

by HuckinFappy (Pilgrim)
on Aug 02, 2006 at 19:21 UTC ( [id://565299]=perlquestion: print w/replies, xml ) Need Help??

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

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

  • Comment on How to get pod2usage to pipe into a pager?

Replies are listed 'Best First'.
Re: How to get pod2usage to pipe into a pager?
by friedo (Prior) on Aug 02, 2006 at 19:28 UTC
    See the -output option in the 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?
by Fletch (Bishop) on Aug 02, 2006 at 19:29 UTC

    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?
by HuckinFappy (Pilgrim) on Aug 03, 2006 at 04:32 UTC
    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? :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-23 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found