[tpm] Implementing a 'less' like pager in perl
Digimer
linux at alteeve.com
Mon Mar 1 17:49:26 PST 2010
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!
More information about the toronto-pm
mailing list