pht has asked for the wisdom of the Perl Monks concerning the following question:
Hello all,
I'm using Getopt::Euclid to create a command line parser up to this spec:
Usage:
dbsetup.pl <dbfile> [options]
Required arguments:
<dbfile>
Database file name. Existing files will not be overwritten unless the
force parameter is specified.
Options:
-f | --force
Force overwrite of existing database file.
-m <X> | --mockup=<X>
Insert mock-up data set X into the database.
The funny behavior I get is that './dbsetup -d', which has an invalid flag, will happily assume '-d' is the filename; is there a way to make it more gnu-getopt like? Ie. -d bails out with 'invalid flag' unless one specifically runs './dbsetup -- -d'?
Even more funny is that './dbsetup -m' will not die of something like '-m should be followed by a parameter and is not AND you didnt specify a filename', but also assume '-m' is the file name! Isn't this erroneous?
Thanks, Michal
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getopt::Euclid, strange behavior & how to fix?
by JavaFan (Canon) on Nov 05, 2008 at 14:03 UTC | |
by pht (Acolyte) on Nov 05, 2008 at 15:48 UTC | |
by JavaFan (Canon) on Nov 05, 2008 at 15:54 UTC | |
by pht (Acolyte) on Nov 05, 2008 at 17:13 UTC | |
by Anonymous Monk on Nov 06, 2008 at 10:23 UTC | |
|
Re: Getopt::Euclid, strange behavior & how to fix?
by toolic (Bishop) on Nov 06, 2008 at 15:04 UTC | |
|
Re: Getopt::Euclid, strange behavior & how to fix?
by Anonymous Monk on Nov 07, 2008 at 06:38 UTC |