cvsuser 04/02/09 14:03:50
Modified: App-Options CHANGES Makefile.PL TODO
App-Options/lib/App Options.pm
Log:
minor cleanups
Revision Changes Path
1.4 +4 -0 p5ee/App-Options/CHANGES
Index: CHANGES
===================================================================
RCS file: /cvs/public/p5ee/App-Options/CHANGES,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- CHANGES 30 Jan 2004 15:15:07 -0000 1.3
+++ CHANGES 9 Feb 2004 22:03:50 -0000 1.4
@@ -2,6 +2,10 @@
# CHANGE LOG
#############################################################################
+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
+
VERSION 0.63
x improve documentation (api reference, logic flow, usage tutorial)
x "integer" type now matches integers with underscores (i.e. 1_000_000)
1.5 +7 -6 p5ee/App-Options/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /cvs/public/p5ee/App-Options/Makefile.PL,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- Makefile.PL 30 Jan 2004 15:15:07 -0000 1.4
+++ Makefile.PL 9 Feb 2004 22:03:50 -0000 1.5
@@ -1,6 +1,6 @@
######################################################################
-## File: $Id: Makefile.PL,v 1.4 2004/01/30 15:15:07 spadkins Exp $
+## File: $Id: Makefile.PL,v 1.5 2004/02/09 22:03:50 spadkins Exp $
######################################################################
use ExtUtils::MakeMaker;
@@ -14,7 +14,8 @@
%opts = (
'NAME' => 'App-Options',
'DISTNAME' => 'App-Options',
- 'VERSION' => '0.63',
+ #'VERSION' => '0.00', # not used
+ 'VERSION_FROM' => 'lib/App/Options.pm',
'EXE_FILES' => [ @programs ],
'dist' => {'COMPRESS'=>'gzip -9f', 'SUFFIX' => 'gz',
'ZIP'=>'/usr/bin/zip','ZIPFLAGS'=>'-rl'},
1.5 +10 -4 p5ee/App-Options/TODO
Index: TODO
===================================================================
RCS file: /cvs/public/p5ee/App-Options/TODO,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- TODO 30 Jan 2004 15:15:07 -0000 1.4
+++ TODO 9 Feb 2004 22:03:50 -0000 1.5
@@ -1,12 +1,19 @@
######################################################################
-## File: $Id: TODO,v 1.4 2004/01/30 15:15:07 spadkins Exp $
+## File: $Id: TODO,v 1.5 2004/02/09 22:03:50 spadkins Exp $
######################################################################
-These two items are what will be required to go to version 1.00.
+These items are what will be required to go to version 1.00.
+ o use File::Spec to make file/directory manipulation platform-independent
o figure out a way to do it outside the BEGIN block (i.e. use App::Options
qw(:init))
These are other interesting things
- o make lots more tests
+ o here documents, var = <<EOF
+ o line continuation chars, i.e. var = hello \
+world
+ o make lots more tests (starting with the examples in the documentation)
+ 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 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)
@@ -18,7 +25,6 @@
3 = [1+2] + silently don't include options from file not defined by program
4 = [1+2+3] + options from file not defined by program cause errors
o write "prefix.pod"
- o here documents, var = <<EOF
o try use lib "dir"; instead of unshift(@INC,"dir") (interaction with "arch")
o consider checking the PERL5LIB variable under -T
1.5 +11 -4 p5ee/App-Options/lib/App/Options.pm
Index: Options.pm
===================================================================
RCS file: /cvs/public/p5ee/App-Options/lib/App/Options.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- Options.pm 30 Jan 2004 15:15:07 -0000 1.4
+++ Options.pm 9 Feb 2004 22:03:50 -0000 1.5
@@ -1,14 +1,17 @@
#############################################################################
-## $Id: Options.pm,v 1.4 2004/01/30 15:15:07 spadkins Exp $
+## $Id: Options.pm,v 1.5 2004/02/09 22:03:50 spadkins Exp $
#############################################################################
package App::Options;
+use vars qw($VERSION);
use strict;
use Carp;
+$VERSION = 0.64;
+
=head1 NAME
App::Options - combine command line options, environment vars, and option file
values
@@ -116,7 +119,7 @@
http://www.officevision.com/pub/p5ee
http://p5ee.perl.org
-=head1 REFERENCE: Methods
+=head1 API REFERENCE: Methods
=cut
@@ -743,9 +746,13 @@
sub print_usage {
shift if ($#_ > -1 && $_[0] eq "App::Options");
my ($values, $init_args) = @_;
+ $values = {} if (!$values);
+ $init_args = {} if (!$init_args);
+
print STDERR "Usage: $0 [options]\n";
printf STDERR " --%-32s print this message (also -?)\n", "help";
my (@vars, $show_all, %option_seen);
+ $show_all = $init_args->{show_all};
if ($init_args->{options}) {
@vars = @{$init_args->{options}};
$show_all = 0 if (! defined $show_all);
@@ -775,7 +782,7 @@
}
}
-=head1 FLOW: OPTION PROCESSING DETAILS
+=head1 LOGIC FLOW: OPTION PROCESSING DETAILS
Basic Concept - By calling App::Options->init(),
your program parses the command line, environment variables,
@@ -1169,7 +1176,7 @@
tests, the App::Options::print_usage() function is called
to print out a usage statement and the program is exited.
-=head1 TUTORIAL
+=head1 USAGE TUTORIAL
=head2 Getting Started