Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Perl Learner
June 13, 2005, 3:05 pm
rate this thread
I am using Getopt::Long to get command line options and I like the fact
that it gives a warning if the options are not given arguments.
But the problem is that it gives the warning and the program continues
How do i make it die after saying "option requires an argument" ?
I think there is a way to "catch" errors but I am unable to figure it
Any direction in this regard would help a great deal.
Re: Getopt::Long (how to make it die after saying "option requires an argument"?)
Perl Learner wrote:
The short answer: See the documentation:
As I read the docs, you are advised to write a "die" and prepare a
"die" message for each option defined. (See
way, an error will directly guide you to the source of the problem. If
you don't do that, then the failure to load an option will simply be
noted as an error, and the overall GetOpts function will emit the
warning message you are seeing.