use warnings;
use strict;
use Getopt::Long qw(:config no_auto_abbrev);
my %opt;
GetOptions(\%opt, qw(readonly)) or die;
| [reply] [d/l] [select] |
What is your concern? Is the problem that you might have an option "readonly", and another option "runonly", and you are worried that "--r" will be ambiguous from within the application? Or are you concerned that people might grow accustomed to using --r only to later find things break once you've added runonly? If the concern is the former, you needn't worry; Getopt::Long's POD has this to say:
Without additional configuration, GetOptions() will ignore the case of option names, and allow the options to be abbreviated to uniqueness.
GetOptions ('length|height=f' => \$length, "head" => \$head);
This call will allow --l and --L for the length option, but requires a least --hea and --hei for the head and height options.
So the first possible issue is unfounded, and documented in the module's POD (which the author spent time writing with the hope that you, the user, would read).
The second possible issue is a social one; the concern that people will get in the habit of using the abbreviations, only to have them become invalidated by the addition of options that push uniqueness further along in the option's string. And for that, the POD is also helpful, by documenting the auto_abbrev configuration setting.
| [reply] [d/l] [select] |
Thanks , Getopt::Long's POD link really helped. I didnt know that auto_abbrev existed :)
| [reply] |