|o||Standard command-line arguments: -help, -doc, -version, -verbose, and -debug. AppConfig::Std handles the -help, -doc, and -version switches for you, so you dont need to duplicate that code in all of your scripts. These are described below.|
The ARGCOUNT default is set to 1. This means that by default
all switches are expected to take a value. To change this,
set the ARGCOUNT parameter when defining the variable:
The module adds five standard configuration variables and command-line switches. You can define additional variables as you would with AppConfig.
The <B>-helpB> switch will result in a short help message. This is generated using Pod::Usage, which displays the <B>OPTIONSB> section of your pod. The script will exit with an exit value of 0.
The <B>-docB> switch will result in the entire documentation being formatted to the screen. This is also done with Pod::Usage. The script will exit with an exit value of 0.
The <B>-versionB> switch will display the version of the invoking script. This assumes that you have defined $VERSION in your script with something like the following:
use vars qw( $VERSION ); $VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/);
The script will exit with an exit value of 0.
The <B>-debugB> switch just sets the <B>debugB> variable. This is useful for displaying information in debug mode:
$foobar->dump() if $config->debug;
The <B>-verboseB> switch just sets the <B>verboseB> variable. This is useful for displaying verbose information as a script runs:
print STDERR "Running foobar\n" if $config->verbose;
Please let me know if you have ideas for additional switches, or other modifications. Things currently being mulled:
o Support brief switches, such as <B>-hB> as well as <B>-helpB>. This could be a config option for the constructor. o Include a sample script called <B>mkscriptB>, which would create a template script along with Makefile.PL, MANIFEST, etc. Kinda of a h2xs for scripts.
The following is the outline of a simple script that illustrates use of the AppConfig::Std module:
The pod documentation is expected to have the NAME, SYNOPSIS, DESCRIPTION, and OPTIONS sections. See the documentation for pod2man for more details.
AppConfig - Andy Wardleys module for unifying command-line switches and cofiguration files into the notion of configuration variables. AppConfig::Std requires version 1.52+ of the module, which is available from CPAN.
Pod::Usage - Brad Appletons module for extracting usage information out of a files pod. This is used for the <B>-docB> and <B>-helpB> switches. Available from CPAN as part of the PodParser distribution.
pod2man <https://metacpan.org/pod/distribution/podlators/scripts/pod2man> - particularly the NOTES section in the documentation which describes the sections you should include in your documentation. AppConfig::Std uses Pod::Usage, which assumes well-formed pod.
Neil Bowers <email@example.com>
Copyright (c) 2002-2013 Neil Bowers.
Copyright (c) 1998-2001 Canon Research Centre Europe. All rights reserved.
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||APPCONFIG::STD (3)||2015-10-26|