My new favorite Perl module is a very unassuming chap that makes your help and usage notes for your Perl scripts just a little bit sexier…
When you have a fairly complicated script that requires lots of help and usage information, it will probably scroll past one page of the display when you dump it to STDOUT.
Sure, your users could pipe the output through less
or more
(…and we all know that less
is more right?) but why make them do
that?
Enter IO::Pager
…a clever
little module that’s quite easy to use. The pattern I’m using is to
use it, if it’s available…
my $token = eval { require IO::Pager; IO::Pager::open( *STDOUT, '|-:utf8', 'Unbuffered' ); }; print {*STDOUT} <<'END_OF_USAGE'; usage: $0 options command Script to do blah blah blah... Options ------- ... END_OF_USAGE