Subject: | Possible problem with aliases |
I LOVE Getopt::Long but I may have bumped into an interesting problem with aliasing.
I expect the third run of the test to give the same results as the second but it does not.
run 1> ./getopt-long-test.pl --com -q --emch
Getopt::Long version=2.39 - Perl version=5.018000
1 compressAll=0 quiet=0 emchk=0
2 compressAll=1 quiet=1 emchk=1
run 2> ./getopt-long-test.pl --nocom -noq --noemche
Getopt::Long version=2.39 - Perl version=5.018000
1 compressAll=0 quiet=0 emchk=0
2 compressAll=0 quiet=0 emchk=0
run 3> ./getopt-long-test.pl --nocom -noq --noemch
Getopt::Long version=2.39 - Perl version=5.018000
1 compressAll=0 quiet=0 emchk=0
2 compressAll=0 quiet=0 emchk=1
schumack@ic-wiki 06-12T12:31:02 1702> cat ./getopt-long-test.pl
#!/usr/local/bin/perl -w
use strict;
use Getopt::Long qw(GetOptions);
my $compressAll = 0;
my $emchk = 0;
my $quiet = 0;
print "Getopt::Long version=$Getopt::Long::VERSION - Perl version=$]\n";
print "1 compressAll=$compressAll quiet=$quiet emchk=$emchk\n";
GetOptions(
'compressall|ca!' => \$compressAll,
'emchk|emcheck!' => \$emchk,
'quiet!' => \$quiet,
);
print "2 compressAll=$compressAll quiet=$quiet emchk=$emchk\n";