[Quoting Bill Ward, on February 12 2009, 16:15, in "autoabbrev algorithm"]
> Do you know of any Perl module that provides the algorithm used in
> Getopt::Long to implement the automatic abbreviation feature?  I'd like to
> have that feature available for not just command-line arguments, but
> subroutine arguments in modules that I write.

I feel honoured but I have to disagree.

Abbreviations are for people typing input (in general, commands).
Using abbreviations in programs and script is a bad idea and asking
for troubles.

Why? Because utilities change and new options may be added. An
abbreviation that uniquely identifies an option (or parameter) may
suddenly become ambiguous. Now, if that happens to you while typing a
command you just raise your eyebrows and add another letter to make it
unique again. But imagine a whole bunch of system administration
scripts that suddenly start failing...

Use abbreviations as much as you like while typing, but NEVER use
abbreviations in programs and scripts because they'll bite you sooner
or later.

> I could just extract the code from Getopt::Long but I think it would
> be a useful thing to have as a CPAN module...

No problem with that, but since this is only supposed to assist
typing, would't looking at readline completions be a better idea?

-- Johan

Reply via email to