###################################################################### ## File: $Id: README 3442 2005-05-14 14:14:01Z spadkins $ ######################################################################

  1. What is the App-Options distribution?

You might say App-Options distribution is "yet another command line option processor." However, it was created for maximum ease of use with the needs of the Perl 5 Enterprise Environment in mind (more on that later).

The distribution consists of one Perl module and one shell script.

App::Options - a perl module which combines command line parameters,

       environment variables, and configuration files to produce
       a hash of option values.

prefix - a shell script which works for ksh (Korn shell) or

       bash (Bourne Again Shell) which allows you to change
       a family of environment variables (PATH, LD_LIBRARY_PATH,
       MANPATH, etc.) necessary for running programs out of a
       directory in which software has been installed.
       (This script is useful but not necessary, and non-Unix users
       may safely ignore it.)

2. What are the features?

FEATURES OF App::Options

#1 Support multiple installations of a complex suite of software.

This is useful for development and deployment of large systems, where multiple versions may be in varying states of development, testing, or production.

#2 Support a suite of programs all using a common set of configuration

files. Large systems have many programs. We don't want to repeat the database name, username, and password in a separate config file for each program.

#3 Make it so easy to use that a developer would be silly not to

use it in even his smallest and simplest of scripts. However, it should be powerful enough to support advanced features as the developer needs them.

#4 Support conditions where the environment variables are not

easy to control. i.e. CGI programs or cron jobs.

These were important design goals to support the App-Context variant of the Perl 5 Enterprise Environment (P5EE). See the P5EE website (http://www.officevision.com/pub/p5ee) for more details.

4. Why another module? Why not use Getopt::Long or others?

There are many configuration modules on CPAN. See

http://search.cpan.org/modlist/Option_Parameter_Config_Processing

The most important feature was to be able to run it within a BEGIN block to modify the Perl include path (@INC). This is most of design goal #1. This means very few dependencies and only on core modules.

I started by writing a few lines of code in a BEGIN block. Then it got to be a lot of lines of code in a BEGIN block. Then I moved it out to a module so I could reuse it easily. Then it grew into a full-fledged command line, environment variable, and config file value option processor.

I did try Getopt::Long, but it wasn't that easy to use, you had to code your own "--help" feature, and it didn't incorporate environment variables or config files. I wanted something more high-level and full-featured, so I wrote App::Options.

The description of the AppConfig distribution sounds similar to what is described here. However, the following are the key differences.

Design goal #4 required the autodetection of the ${prefix} variable. Thus, the App::Options module can be integrated with the discipline of choosing a root directory for your software installation (i.e. PREFIX=/usr/mycompany/2.0.12).

5. You say it's so easy. Show me.

#!/usr/bin/perl
use App::Options;
# now use the %App::options hash
print "yada yada\n" if ($App::options{verbose});

It's that easy.

And it automatically has "-?" and "--help" support without you having to code a thing.

Read the man page (or the code) if you want more power.

6. How do I install it?

To install this module, cd to the directory that contains this README file and type the following (as usual).

perl Makefile.PL
make
make test
make install