Skip Menu |

This queue is for tickets about the Getopt-Long CPAN distribution.

Report information
The Basics
Id: 114335
Status: rejected
Priority: 0/
Queue: Getopt-Long

People
Owner: jv [...] cpan.org
Requestors: dwheeler [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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"; +}
Let's agree we do not support this.
Subject: Re: [rt.cpan.org #114335] pass_through fails to pass through bundled Option
Date: Tue, 13 Aug 2019 15:29:18 -0400
To: bug-Getopt-Long [...] rt.cpan.org
From: "David E. Wheeler" <david [...] justatheory.com>
On Aug 13, 2019, at 1:42 PM, Johan Vromans via RT <bug-Getopt-Long@rt.cpan.org> wrote: Show quoted text
> Let's agree we do not support this.
Curious why. Are you thinking that pass-through and non-pass-through options shouldn’t be bundled? In Sqitch, there are core options evaluated with pass-through, and command options, which are evaluated later. From the user’s perspective, they’re arguably not separate sets of options, they’re all just options, so the distinction might feel artificial, even though they’re completely separate in the code. Thanks, David
Show quoted text
> Are you thinking that pass-through and non-pass-through options shouldn’t be bundled?
No, it is just pretty hard to solve, with great risks of breaking other obscure cases. If someone wants to give it a try please do so. I welcome PRs.
Subject: Re: [rt.cpan.org #114335] pass_through fails to pass through bundled Option
Date: Wed, 14 Aug 2019 10:41:40 -0400
To: bug-Getopt-Long [...] rt.cpan.org
From: "David E. Wheeler" <david [...] justatheory.com>
On Aug 14, 2019, at 3:35 AM, Johan Vromans via RT <bug-Getopt-Long@rt.cpan.org> wrote: Show quoted text
> No, it is just pretty hard to solve, with great risks of breaking other obscure cases.
Got it, thank you. It hasn’t come up in the wild AFAIK, just something I noticed when I was merging options in Sqitch. Thanks, David