Subject: | The catch-all option spec '<>' isn't recognized by Getopt::Long::Complete |
Run in bash:
complete -C ./test-complete.pl ./test-complete.pl
chmod +x ./test-complete.pl
Now type:
./test-complete.pl -<tab>
You're given --clean and --purge as options
Now:
export SHOWBUG=1
./test-complete.pl -<tab>
The script dies with:
Can't parse option spec '<>' at ~/perl5/CPAN/lib/perl5/Complete/Getopt/Long.pm line 300.
Separate, just doing:
unset SHOWBUG
./test-complete.pl <tab>
Results in a die with:
Can't use an undefined value as a subroutine reference at ~/perl5/CPAN/lib/perl5/Complete/Getopt/Long.pm line 559.
Subject: | test-complete.pl |
#!/usr/bin/env perl
use Getopt::Long::Complete;
my $clean = 0;
my $purge = 0;
my @other;
my @OPTIONS = (
"clean" => \$clean,
"purge" => \$purge
);
if ($ENV{SHOWBUG}) {
push @OPTIONS,
'<>' => sub {
push @other, $_
};
}
GetOptions( @OPTIONS ) or die "bad options";