[tpm] Fwd: Implementing a 'less' like pager in perl

Emil Janev ejanev at gmail.com
Tue Mar 2 08:10:09 PST 2010


---------- Forwarded message ----------
From: Emil Janev <ejanev at gmail.com>
Date: Tue, Mar 2, 2010 at 11:07 AM
Subject: Re: [tpm] Implementing a 'less' like pager in perl
To: Digimer <linux at alteeve.com>



You could check Pod::Usage module which is in the Perl core for some time.

http://perldoc.perl.org/Pod/Usage.html


The examples there are pretty much clear.

To get the paging:

pod2usage(-verbose => 2)


will print what "perldoc program_name" will print, paging included with it.

--
Emil



On Mon, Mar 1, 2010 at 8:49 PM, Digimer <linux at alteeve.com> 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". That screams of "cop-out" though.
>
>  I know I could use perldoc, but I don't like assuming that my user knows
> anything about perl.
>
>  I've already got code to handle line wrapping and indenting lines. I just
> need some way to stop my output after X number of lines, where X is the
> terminal's number of rows, and then take the up and down arrows to scoll up
> and down through the message, with ESC or Q exiting.
>
>  Any tips/pointers?
>
> Thanks!
>
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>



-- 
Emil Janev



-- 
Emil Janev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20100302/c2c57b6b/attachment.html>


More information about the toronto-pm mailing list