The following module was proposed for inclusion in the Module List:
modid: CLI::Startup
DSLIP: bdphp
description: Simple initialization of command-line script
userid: BUDNEY (Leonard R Budney)
chapterid: 8 (User_Interfaces)
communities:
similar:
Getopt::Long, Config::Simple
rationale:
Good command-line scripts always support command-line options using
Getopt::Long, and /should/ support default configuration in a .rc
file, such as Config::Simple supports. At minimum that should
include a --help option that explains the other options. Supporting
all this takes quite a bit of boilerplate code. In my experience,
doing it right takes several hundred lines of code that are
practically the same in every script.
CLI::Startup is intended to factor away almost all of that
boilerplate. In the common case, all that's needed is a single
hashref listing the options (using Getopt::Long syntax) as keys, and
a bit of help text as values. CLI::Startup will automatically
generate the command-line parsing, reading of an optional config
file, merging of the two, and creation of a hash of the actual
settings to be used for the current invocation. It automatically
prints a usage message when it sees invalid options or the --help
option. It automatically supports an option to save the current
settings in an rc file. It supports a --version option that prints
$::VERSION from the calling script, and a --manpage option that
prints the formatted POD, if any, in the calling script. All the
grunt work is handled for you.
CLI::Startup also supports additional options to disable any of
those options EXCEPT --help, and to specify default options. It
slightly enhances Getopt::Long behavior by allowing repeatable
options to be specified /either/ with multiple options /or/ with a
commalist honoring CSV quoting conventions. It also enhances
Config::Simple behavior by supporting options with hashes as values,
and by un-flattening the contents of INI files into a two-level
hash.
For convenience, CLI::Support also supplies a die() and warn()
method that prepend the name of the script and postpend a newline.
enteredby: BUDNEY (Leonard R Budney)
enteredon: Thu Jul 7 15:45:30 2011 GMT
The resulting entry would be:
CLI::
::Startup bdphp Simple initialization of command-line script BUDNEY
Thanks for registering,
--
The PAUSE
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=8a500000_932fa26e531ab718&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=8a500000_932fa26e531ab718&SUBMIT_pause99_add_mod_insertit=1
Peek at the current permissions:
https://pause.perl.org/pause/authenquery?pause99_peek_perms_by=me&pause99_peek_perms_query=CLI%3A%3AStartup