Bug#504855: Getopt::Long does not always respect no_ignore_case with pass_through

Niko Tyni ntyni at debian.org
Sat Nov 6 07:13:04 UTC 2010


On Fri, Nov 07, 2008 at 06:22:34PM +0100, Jeffrey Ratcliffe wrote:
> Package: perl
> Version: 5.10.0-11

Sorry about the delay.

> The attached program illustrates the problem. The output in all recent
> versions up to 5.10.0-11 is below:
> 
> $./GO.pl
> $VAR1 = {
>           'l' => 'foo'
>         };
> $VAR1 = {
>           'L' => 1
>         };
> $VAR1 = {
>           'l' => 'foo'
>         };
> $VAR1 = {};
> 
> As no_ignore_case is turned on, and a -L option is not used, the 'L'
> => 1 from the second print statement is incorrect, and should be 'l'
> => 1, similarly, the fourth print statement should also produce 'l' =>
> 1

The L => 1 in the second case is because '-l' is an abbreviation of the
'list-devices' alias, not because it matches the short '-L' form.
Quoting the documentation:

       In the default configuration, options names may be abbreviated to
       uniqueness, case does not matter, and a single dash is sufficient,
       even for long option names.

and

       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.

so '-L' => 1 seems correct to me.

With the fourth statement the '-l' option is not allowed so all the args
end up in @ARGV (since pass_through is set.)

I don't see a bug here. Please elaborate or let me know if I can close this.
-- 
Niko Tyni   ntyni at debian.org






More information about the Perl-maintainers mailing list