This is the README file for AppConfig Version 1.52
AppConfig is a bundle of Perl5 modules for reading configuration files
and parsing command line arguments. This is a descendant of, and
supercedes the App::Config module. Functionality is extended over the
final version of App::Config (1.09) and includes many new features. This
module has been developed and in the process, renamed, as part of an
effort to unify the various Perl modules for parsing configuration files
and command line arguments.
AppConfig has a powerful but easy to use module for parsing configuration
files. It also has a simple and efficient module for parsing command line
arguments. For fully-featured command line parsing, a module is provided
for interfacing AppConfig to Johan Vromans' extensive Getopt::Long module.
Johan will continue to develop the functionality of this package and its
features will automatically become available through AppConfig.
All of the modules and features of the AppConfig bundle are easily
accessible through the AppConfig.pm module.
Relevant changes to the AppConfig module are documented in the Changes
files.
The rest of this document contains information extracted from relevant
sections of the AppConfig.pm documentation.
NAME
AppConfig - Perl5 module for reading configuration files and parsing
command line arguments.
OVERVIEW
AppConfig is a Perl5 module for managing application configuration
information. It maintains the state of any number of variables and
provides methods for parsing configuration files and command line
arguments.
Variables values may be set via configuration files. Variables may be
flags (On/Off), take a single value, or take multiple values stored as a
a list or hash. The number of arguments a variable expects is determined
by its configuration when defined.
# flags
verbose
nohelp
debug = On
# single value
home = /home/abw/
# multiple list value
file = /tmp/file1
file = /tmp/file2
# multiple hash value
book camel = Programming Perl
book llama = Learning Perl
The '-' prefix can be used to reset a variable to its default value and
the '+' prefix can be used to set it to 1
-verbose
+debug
Variable, environment variable and tilde (home directory) expansions can
be applied (selectively, if necessary) to the values read from
configuration files:
home = ~ # home directory
nntp = ${NNTPSERVER} # environment variable
html = $home/html # internal variables
img = $html/images
Configuration files may be arranged in blocks as per the style of Win32
"INI" files.
[file]
site = kfs
src = ~/websrc/docs/$site
lib = ~/websrc/lib
dest = ~/public_html/$site
[page]
header = $lib/header
footer = $lib/footer
Variables may also be set by parsing command line arguments.
myapp -verbose -site kfs -file f1 -file f2
AppConfig provides a simple method (args()) for parsing command line
arguments. A second method (getopt()) allows more complex argument
processing by delegation to Johan Vroman's Getopt::Long module.
PREREQUISITES
AppConfig requires Perl 5.004 or later.
The AppConfig::Getopt module uses Getopt::Long for advanced command-line
option processing and requires version 2.17 or later. There is also a
simple internal module (AppConfig::Args) for command line parsing that
does not have the flexibility of AppConfig::Getopt but is smaller and
incurs less overhead. The Getopt::Long module is not required when this
is used. The Makefile.PL specifies Getopt::Long version 2.17 as a pre-
requisite. If you wish to use AppConfig without Getopt::Long then
comment out the following line in the Makefile.PL:
# 'PREREQ_PM' => { 'Getopt::Long' => 2.17 },
No action is necessary if you already have Getopt::Long 2.17 or later
installed. Getopt::Long is available from any CPAN site (see below).
All AppConfig::* and other modules (e.g. Getopt::Long) are dynamically
loaded by the AppConfig module as and when required.
OBTAINING AND INSTALLING THE AppConfig MODULE BUNDLE
The AppConfig module bundle is available from CPAN. As the 'perlmod'
manual page explains:
CPAN stands for the Comprehensive Perl Archive Network.
This is a globally replicated collection of all known Perl
materials, including hundreds of unbundled modules.
[...]
For an up-to-date listing of CPAN sites, see
http://www.perl.com/perl/ or ftp://ftp.perl.com/perl/ .
Within the CPAN archive, AppConfig is in the category:
12) Option, Argument, Parameter and Configuration File Processing
The module is available in the following directories:
/modules/by-module/AppConfig/AppConfig-.tar.gz
/authors/id/ABW/AppConfig-.tar.gz
AppConfig is distributed as a single gzipped tar archive file:
AppConfig-.tar.gz
Note that "" represents the current AppConfig Revision number,
of the form "2.00". See the REVISION section below to determine the
current version number for AppConfig.
Unpack the archive to create a AppConfig installation directory:
gunzip AppConfig-.tar.gz
tar xvf AppConfig-.tar
'cd' into that directory, make, test and install the modules:
cd AppConfig-
perl Makefile.PL
make
make test
make install
The 't' sub-directory contains a number of test scripts that are run
when a 'make test' is run.
The 'make install' will install the module on your system. You may need
administrator privileges to perform this task. If you install the module
in a local directory (for example, by executing "perl Makefile.PL
LIB=~/lib" in the above - see `perldoc MakeMaker' for full details), you
will need to ensure that the PERL5LIB environment variable is set to
include the location, or add a line to your scripts explicitly naming
the library location:
use lib '/local/path/to/lib';
The 'examples' sub-directory contains some simple examples of using the
AppConfig modules.
AUTHOR
Andy Wardley, `', http://www.kfs.org/~abw/
Web Technology Group, Canon Research Centre Europe Ltd.
REVISION
$Revision: 1.52 $
COPYRIGHT
Copyright (C) 1998 Canon Research Centre Europe Ltd. All Rights
Reserved.
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
AppConfig::State, AppConfig::File, AppConfig::Args, AppConfig::Getopt
Getopt::Long