LPM: tricks with getopt
Frank Price
fprice at upended.org
Tue Oct 2 16:10:21 CDT 2001
Hiya Perlers,
I have a question about GetOpt::Long. I'm generally in favor of having
configuration files so that no customization needs to be done to the
perl script itself. Given that, I would like users to be able to give
various undetermined flags to a script, and then let the config file
figure out what to do with them. For instance, users on machine one
might run
script --foo
while users on machine two might run
script --bar
Then the script in conjunction with the config file would decide what to
do with the options.
But to do this, I can't specify the flag explicitly in my call to
getopts. And there doesn't seem to be a default. What I'm looking for
is some way to tell getopts "put any flag you don't know about into this
hash as the key (or add to this array, etc.)."
Anyone have any bright ideas? I like using GetOpt 'cause then I don't
have to handle it myself. And I don't want to do 'script --opt=foo' to
cut down on typing.
Thanks!
--
Frank Price | fprice at upended.org | www.upended.org/fprice/
GPG key: www.upended.org/fprice/gpg.asc | E Pluribus Unix
More information about the Lexington-pm
mailing list