CC: | ANDK [...] cpan.org, gbhull [...] gmail.com |
Subject: | Documentation: Must names and aliases be spelled in diminishing-length order? |
Please see discussion in this bug ticket:
https://rt.perl.org/Ticket/Display.html?id=130764
In comment https://rt.perl.org/Ticket/Display.html?id=130764#txn-1448515, Andreas Koenig suggests that there is a documentation error in Getopt::Long. The relevant section (in v2.48 found in perl-5.24.1) is:
#####
Options with multiple names
Often it is user friendly to supply alternate mnemonic names for options.
For example "--height" could be an alternate name for "--length".
Alternate names can be included in the option specification, separated by
vertical bar "|" characters. To implement the above example:
GetOptions ('length|height=f' => \$length);
The first name is called the primary name, the other names are called
aliases. When using a hash to store options, the key will always be the
primary name.
Multiple alternate names are possible.
#####
Andreas suggests that the primary name and its aliases should be arranged left-to-right in diminishing length order. My experimentation confirms that this would resolve the problem cited by the original poster in perl:130764.
Can the Getopt::Long documentation be adjusted?
Thank you very much.
Jim Keenan