in reply to print # of lines in window?

I would put all the long-winded stuff into POD, and have just a short usage message -- a synopsis -- displayed in response to "-h" or "--help", or when required args are lacking, or when args are not compatible with allowed usage. The synposis simply lists the expected args and the allowed options in a nice, brief, easy-to-read format, and can end with something like "run perldoc $0 for full documentation".

For mac users running the script in a Terminal (or X-windows xterm), perldoc will automatically put the POD man page through the default paging program (usually "more" or "less"), and will make it look very polished and professional. Here's a typical template that I use for just about every perl script that I write:

#!/usr/bin/perl # fill in paragraphs between the "=head1" lines: =head1 NAME =head1 SYNOPSIS =head1 DESCRIPTION =cut use strict; my $Usage = "$0 "; # fill in synopsis here, as well as above
The perlpod man page explains how to put your "man page" documentation into your script. Also, the man page for Getopt::Long (you are using that module, aren't you?) has a section on "Documentation and help texts" which explains how to avoid having to duplicate your synopsis string.

(Note that my suggested template above requires the synopsis to be in two places -- that's because I haven't memorized that portion of the Getopt::Long man page yet...)

Update: If you are writing a command-line tool, and are intending that the user carry on a keyboard dialog with the script while it is running, I would offer the following suggestions:

If the script needs a lot of input from the user, but all of it is knowable in advance, then you're talking about "input data", which should be read from a file that the user provides (in @ARGV) -- the less keyboarding, the better.

Replies are listed 'Best First'.
Re^2: print # of lines in window?
by duckyd (Hermit) on Oct 31, 2006 at 01:41 UTC
    IO::Prompt is pretty helpful if you need to prompt the user for input