Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Requiring option values in Getopt::Long

by markkawika (Monk)
on Aug 20, 2009 at 00:04 UTC ( [id://789975]=note: print w/replies, xml ) Need Help??


in reply to Requiring option values in Getopt::Long

Getopt::Long will not exit for you; it will warn you (and the user) about the error, but it's up to you to exit if there was a problem.

Be sure to check the return value from GetOptions:

use Getopt::Long; my $option_test; my $result = GetOptions ( 'test=s' => \$option_test ); if (! $result) { die "Invalid option specifications"; }

Example:

$ ./getopt.pl -t Option test requires an argument Invalid option specifications at ./getopt.pl line 9. $

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://789975]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-09-07 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.