[tpm] Implementing a 'less' like pager in perl
James E Keenan
jkeen at verizon.net
Mon Mar 1 18:58:41 PST 2010
On Mar 1, 2010, at 8:49 PM, Digimer wrote:
> Hi all,
> I like to have built-in '--help' messages in some of my programs,
> but am always at a loss for how to allow the user to page through
> it. Usually I have a message at the bottom akin to; "Please call './
> foo --help |less' to make reading this help message easier".
> I know I could use perldoc, but I don't like assuming that my
> user knows anything about perl.
If you "usually" tell the user to call './foo -- help | less', then
it stands to reason your user is familiar with the Unix command-line.
In which case, instructing them to call 'perldoc ./foo' is not much
of a stretch.
Or, you could create 'man' pages for your programs. They, too,
automatically include paging.
If you wrote POD for your programs, you could use 'pod2man' to
generate the man pages. (And I have a CPAN distribution, Pod-Multi,
that will let you generate documentation from POD simultaneously to
text, man and HTML format.)
More information about the toronto-pm