I agree with what's been said here. I too haven't used Getopt::Easy, but use Getopt::Long all of the time. The main reason to not use Getopt::Easy that I can see would be that it isn't a CORE module and would need to be installed on every machine where it is used.
While we're sharing coding idioms.... here is what I always do for commandline arguments:
use strict; use Getopt::Long; # Main body eval { my $options = { 'help' => 0, 'verbose' => 0, 'config' => '/etc/myapp.conf', }; GetOptions( 'help' => \$$options{help}, 'verbose!' => \$$options{verbose}, 'config=s' => \$$options{config}, ); }; print "ERROR: $@" if $@;
This lets you set defaults for your options and GetOptions() handles any commandline overrides by the user.
Frank Wiles <frank@revsys.com>
www.revsys.com
In reply to Re: Seeking Getopt recommendations - anyone used Getopt::Easy?
by ides
in thread Seeking Getopt recommendations - anyone used Getopt::Easy?
by theguvnor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |