in reply to Making Getopt::Long tell me if no parameters passed
It may be worth moving to the more robust version of GetOptions that takes a hash reference as a first argument. For example:
my %opts; GetOptions(\%opts, 'user=s', 'pass=s', 'config=s');
This will store your options in the hash, and you can test whether anything came through with:
usage() unless keys %opts;
I'd recommend this version for use in most cases actually; it seems cleaner to me than a whole list of arguments to scalar references.
|
|---|