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

Re^2: getopt::std to pass arguments to command line help

by Discipulus (Canon)
on Jan 21, 2015 at 08:19 UTC ( [id://1113992]=note: print w/replies, xml ) Need Help??


in reply to Re: getopt::std to pass arguments to command line help
in thread getopt::std to pass arguments to command line help

hextor look at that good example by toolic and pay attention to the GetOptions ... or die; part.
This is very important because you dont want your program to execute with wrong or not accepted args.
Personally i ended using everytime yet another idiom, even more cautious:
use Getopt::Long; use Pod::Usage; # if you have documentation embedded is better unless (GetOptions( "option=s" => \$option ... )) { pod2usage(-verbose => 1,-exitval => 'NOEXIT'); # automatic u +sage printing (if you have an usage section in POD) &wait_for_input; # if the prog + was opend in a 'double click' fashion there is no time # to review e +rrors, if so you can just use something like: # sub wait_fo +r_input{ # print "\n +\nPress Return when ready\n"; # while (<S +TDIN>){last if $_ } # } exit; # now you can + exit or die with yet another error string }

HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found