in reply to getopt?
First problem: the comparison of $args with 2. What is $args? It's not related to the %args hash that the single character options have been loaded into. Unfortunately, I can't figure out what you actually want to test. So that's the first warning you're getting. And with the code you've posted, that's the only one.
After that, you need to note that the parameters you pass cause the appropriate variables to be set, and only those variables. So adding a diagnostic at the end of:
and then passing a parameter --file fred will still cause complaints about all the other values being unset.print "help=$help\n", "file=$file\n", "db=$database\n", "user=$user\n", "password=$password\n";
Finally, and possibly most importantly, GetOptions destroys your @ARGV. So getopts will never have anything to read parameters from
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: getopt?
by azool (Initiate) on Oct 25, 2001 at 02:57 UTC | |
by tommyw (Hermit) on Oct 25, 2001 at 03:30 UTC | |
by premchai21 (Curate) on Oct 25, 2001 at 05:12 UTC | |
by chipmunk (Parson) on Oct 25, 2001 at 19:15 UTC | |
by azool (Initiate) on Oct 25, 2001 at 22:33 UTC |