cvsuser 04/09/02 14:09:00
Modified: App-Options CHANGES Makefile.PL README TODO
Log:
updated
Revision Changes Path
1.6 +7 -0 p5ee/App-Options/CHANGES
Index: CHANGES
===================================================================
RCS file: /cvs/public/p5ee/App-Options/CHANGES,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- CHANGES 19 Feb 2004 16:17:14 -0000 1.5
+++ CHANGES 2 Sep 2004 21:09:00 -0000 1.6
@@ -2,6 +2,13 @@
# CHANGE LOG
#############################################################################
+VERSION 0.91
+ x show_all is off by default whenever "option" or "options" used
+ x remove app_path_info
+
+VERSION 0.90
+ x new "use App::Options (...);" syntax (rather than ->init(...) syntax)
+
VERSION 0.64
x added $VERSION to App::Options (use VERSION_FROM in Makefile.PL)
x fixed bug where "show_all" wasn't showing all on --help
1.6 +2 -3 p5ee/App-Options/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /cvs/public/p5ee/App-Options/Makefile.PL,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- Makefile.PL 9 Feb 2004 22:03:50 -0000 1.5
+++ Makefile.PL 2 Sep 2004 21:09:00 -0000 1.6
@@ -1,6 +1,6 @@
######################################################################
-## File: $Id: Makefile.PL,v 1.5 2004/02/09 22:03:50 spadkins Exp $
+## File: $Id: Makefile.PL,v 1.6 2004/09/02 21:09:00 spadkins Exp $
######################################################################
use ExtUtils::MakeMaker;
@@ -14,8 +14,7 @@
%opts = (
'NAME' => 'App-Options',
'DISTNAME' => 'App-Options',
- #'VERSION' => '0.00', # not used
- 'VERSION_FROM' => 'lib/App/Options.pm',
+ 'VERSION' => '0.91',
'EXE_FILES' => [ @programs ],
'dist' => {'COMPRESS'=>'gzip -9f', 'SUFFIX' => 'gz',
'ZIP'=>'/usr/bin/zip','ZIPFLAGS'=>'-rl'},
1.3 +45 -33 p5ee/App-Options/README
Index: README
===================================================================
RCS file: /cvs/public/p5ee/App-Options/README,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- README 7 Jan 2004 15:24:07 -0000 1.2
+++ README 2 Sep 2004 21:09:00 -0000 1.3
@@ -1,12 +1,13 @@
######################################################################
-## File: $Id: README,v 1.2 2004/01/07 15:24:07 spadkins Exp $
+## File: $Id: README,v 1.3 2004/09/02 21:09:00 spadkins Exp $
######################################################################
1. What is the App-Options distribution?
-The App-Options distribution is "yet another command line 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).
+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.
@@ -19,6 +20,8 @@
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?
@@ -39,8 +42,8 @@
the "whatever = value" statement. Initialization searches
"$HOME/.app/$prog.conf", "$HOME/.app/app.conf",
"$progdir/$prog.conf", "$progdir/app.conf",
- "$prefix/$prog.conf", and "$prefix/app.conf" in order
- to find the option values.
+ "$prefix/$prog.conf", "$prefix/app.conf", and "/etc/app.conf"
+ in order to find the option values.
o Import other files with "import = filename" statement
Config files can, in essence, include other config files.
o Stop importing other files with "flush_imports = 1" statement
@@ -63,11 +66,10 @@
Any section specifier can apply only to a single line by
putting a statement after it. "[city=LAX] state = CA"
o Modify @INC variable with the "perlinc = path1,path2" statement
- If invoked in the BEGIN block, this allows the person deploying
- the software to set up the Perl include path so that a
- particular version of the software installed on the system is
- used. Subsequent uses of "use" and "require" will load modules
- from the configured locations.
+ This allows the person deploying the software to set up the Perl
+ include path so that a particular version of the software
+ installed on the system is used. Subsequent uses of "use" and
+ "require" will load modules from the configured locations.
o Validate that "required" options are provided
Certain options can be identified as required. Otherwise the
program will not run.
@@ -120,41 +122,51 @@
Then it grew into a full-fledged command line, environment
variable, and config file value option processor.
-In retrospect, I don't really know whether or not the other
-modules can run just as well in a BEGIN block and have a special
-feature to modify @INC. However, this met a primary design
-goal of App::Options.
-
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.
-I looked at the description of the AppConfig distribution,
-and it sounds similar to what I describe here. However,
-the meaning of "sections" (i.e. "[cleanup]") is a conditional
-construct in App::Options. Thus, it supports a single
-family of configuration files to configure a whole suite
-of programs and scripts. (Each program can have its own
-section, and optionally its own file in both "user" and
-"system" places.) This met design goal #2.
-
-See the section below on ease of use for design goal #3.
+The description of the AppConfig distribution sounds similar
+to what is described here. However, the following are the key
+differences.
+
+ * App::Options does its option processing in the BEGIN block.
+ This allows for the @INC variable to be modified in time
+ for subsequent "use" and "require" statements.
+ This met design goal #1.
+
+ * App::Options consults a cascading set of option files.
+ These files include those which are system global, project
+ global, and user private. This allows for system
+ administrators, project developers, and in individual
+ users to all have complementary roles on defining
+ the configuration values. This met design goal #2.
+
+ * App::Options "sections" (i.e. "[cleanup]") are conditional.
+ It is conditional in App::Options, allowing you to use one
+ set of option files to configure an entire suite of programs
+ and scripts. In AppConfig, the section name is simply a
+ prefix which gets prepended to subsequest option names.
+ This also helped to meet design goal #2.
+
+ * App::Options is not a toolkit but a standardized way of
+ doing option processing. With AppConfig, you still have
+ to decide where to put config files, you still have to
+ code the "--help" feature, etc. With App::Options, you simply
+ "use App::Options;" and all the hard work is done.
+ Advanced options can be added later as necessary as args
+ to the "use" statement. This met design goal #3.
Design goal #4 required the autodetection of the ${prefix}
-variable. Thus, the App::Options module is integrated with
+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
-
- BEGIN {
use App::Options;
- App::Options->init();
- }
-
# now use the %App::options hash
print "yada yada\n" if ($App::options{verbose});
1.7 +10 -4 p5ee/App-Options/TODO
Index: TODO
===================================================================
RCS file: /cvs/public/p5ee/App-Options/TODO,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- TODO 19 Feb 2004 16:17:14 -0000 1.6
+++ TODO 2 Sep 2004 21:09:00 -0000 1.7
@@ -1,20 +1,25 @@
######################################################################
-## File: $Id: TODO,v 1.6 2004/02/19 16:17:14 spadkins Exp $
+## File: $Id: TODO,v 1.7 2004/09/02 21:09:00 spadkins Exp $
######################################################################
These items are what will be required to go to version 1.00.
o use File::Spec to make file/directory manipulation platform-independent
-These are other interesting things
+These are other interesting things which I might do
+ o add option that documents the args (not just the options) of a command
o here documents, var = <<EOF
- o line continuation chars, i.e. var = hello \
-world
+ o file variables, var = <FILE>filename (or "cmd|")
+ o add a standard ${host} variable
+ o line continuation chars, i.e. var = hello \\nworld
+ o auto-import of environment vars named "APP_*"
+ o multiple levels of "show_all"
o make lots more tests (starting with the examples in the documentation)
o substitute environment vars with "$ENV{PATH}"
o setenv arg to set environment variables
o make example scripts (starting with the examples in the documentation)
o add --version support (print out own version and versions of all modules)
o add "arg" option attribute for the name of the option argument
+ o add "args_description" arg to describe what's left on cmd line after options
removed
o improve debug_options (env vars, etc.)
o enforce other option parsing rules (single letter + arg, single/double dash)
o option aliases/synonyms/alternates (i.e. -s = --silent)
@@ -28,4 +33,5 @@
o write "prefix.pod"
o try use lib "dir"; instead of unshift(@INC,"dir") (interaction with "arch")
o consider checking the PERL5LIB variable under -T
+ o allow for subclassing (App::Options::YAML, etc.) (split up the init() method)