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 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.93 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. 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, `' Web Technology Group, Canon Research Centre Europe Ltd. REVISION $Revision: 0.6 $ 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