Subject: | pass_through fails to pass through bundled Option |
Date: | Wed, 11 May 2016 11:18:34 -0700 |
To: | bug-Getopt-Long [...] rt.cpan.org |
From: | "David E. Wheeler" <dwheeler [...] cpan.org> |
With pass_through and bundling enabled, if an option with a string argument is specified at end of a bundled option, but the preceding options in the bundle are not specified in getopt, Getopt::Long fails to either grab the string argument or to remove it from @ARGV. Failing tests attached.
--- t/gol-linkage.t.orig 2016-05-11 11:12:34.000000000 -0700
+++ t/gol-linkage.t 2016-05-11 11:14:13.000000000 -0700
@@ -11,7 +11,7 @@
use Getopt::Long;
-print "1..37\n";
+print "1..41\n";
@ARGV = qw(-Foo -baR --foo bar);
Getopt::Long::Configure ("no_ignore_case");
@@ -119,3 +119,15 @@
print +(($got eq " remain=-thru,-here,-more,--,1")
? "" : "not ", "ok 37\n");
}
+
+{
+ my $opt = {};
+ @ARGV = qw(-vd foo);
+ Getopt::Long::Configure("default");
+ Getopt::Long::Configure("pass_through", "bundling");
+ print "not" unless GetOptions($opt, 'd=s');
+ print "ok 38\n";
+ print +(defined $opt->{d} && $opt->{d} eq 'foo' ? '' : 'not '), "ok 39\n";
+ print +($ARGV[0] eq '-v' ? '' : 'not '), "ok 40\n";
+ print +(defined $ARGV[1] ? 'not ' : ''), "ok 41\n";
+}