Subject: | callback option arg overloaded to false |
The attached foo.pl run as "perl foo.pl --foo" prints "no", where
I hoped it would print "yes", which is what Getopt::Long version
2.35 did.
I struck this when using a single func as the handler on multiple
options, saving the option value as a mode like "$mode = $opt",
with a check "if ($mode)" before overwriting, to allow just one
--foomode or --barmode or --quuxmode, if you know what I mean.
I guess the overload of "0+" in Getopt::Long::CallBack and/or the
"fallback" setting there somehow makes such an object seem always
false.
Subject: | foo.pl |
use strict;
use warnings;
use Getopt::Long;
sub foo {
my ($opt) = @_;
if ($opt) {
print "yes\n";
} else {
print "no\n";
}
}
GetOptions (foo => \&foo);