1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
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-<version>.tar.gz
/authors/id/ABW/AppConfig-<version>.tar.gz
AppConfig is distributed as a single gzipped tar archive file:
AppConfig-<version>.tar.gz
Note that "<version>" 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-<version>.tar.gz
tar xvf AppConfig-<version>.tar
'cd' into that directory, make, test and install the modules:
cd AppConfig-<version>
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, `<abw@cre.canon.co.uk>', 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
|