Skip Menu |

This queue is for tickets about the Getargs-Mixed CPAN distribution.

Report information
The Basics
Id: 128428
Status: resolved
Priority: 0/
Queue: Getargs-Mixed

People
Owner: Nobody in particular
Requestors: CXW [...] cpan.org
Cc:
AdminCc:

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



Subject: Getargs::Mixed won't accept undef as the value of a parameter
Sterling, Thanks for Getargs::Mixed, which I am using and enjoying. I would like to be able to pass `undef` as the value of a parameter. However, Getargs::Mixed sees that as a missing parameter. Test case (Perl 5.26.3, Cygwin x64): $ perl -E 'use strict; use warnings; use Getargs::Mixed; use Data::Dumper; my @in = ("-foo", undef); say Dumper(\@in); # two elements my (%args) = parameters([qw(foo)], @in); say Dumper(\%args)' $VAR1 = [ '-foo', undef ]; Missing these required arguments: foo at /home/cxw/perl5/lib/perl5/Getargs/Mixed.pm line 235. Getargs::Mixed::parameters(ARRAY(0x600070618), "-foo", undef) called at -e line 7 I believe this is because https://metacpan.org/source/HANENKAMP/Getargs-Mixed-1.03/Mixed.pm#L234 tests for definedness, not existence. I copied Getargs::Mixed and changed only that line from `grep { !defined ...` to `grep { !exists ...`, with the following result: $ perl -E 'use strict; use warnings; use Arrrgs; # My tweaked test module use Data::Dumper; my @in = ("-foo", undef); say Dumper(\@in); # two elements my (%args) = parameters([qw(foo)], @in); say Dumper(\%args)' $VAR1 = [ '-foo', undef ]; $VAR1 = { 'foo' => undef }; I re-ran the Getargs::Mixed test suite with this change, and all tests passed. Would you be willing to consider adding this change to the distribution? Please let me know if you would like more information, tests, examples, or code. Thank you! Sincerely, Chris White (CXW)
Subject: Re: [rt.cpan.org #128428] Getargs::Mixed won't accept undef as the value of a parameter
Date: Wed, 6 Feb 2019 15:36:28 -0600
To: bug-Getargs-Mixed [...] rt.cpan.org
From: Sterling Hanenkamp <sterling [...] hanenkamp.com>
PRs are welcome. Unfortunately on this one, the last release predates github, it predates the invention of git by a couple years. In fact, I doubt I even have the original repo stored anymore, so I probably need to create a new one forked by gitpan. Either that, or I'd be willing to give you a maintainer flag in PAUSE so you can make the change and release it yourself to CPAN. If I do it, I'll have to retool the thing to use my modern development kit, which isn't hard, but time consuming enough that it might get put off indefinitely given all the other random things I'm doing in my O(fun) time. Cheers. On Tue, Feb 5, 2019 at 7:02 PM Christopher White via RT < bug-Getargs-Mixed@rt.cpan.org> wrote: Show quoted text
> Tue Feb 05 20:02:25 2019: Request 128428 was acted upon. > Transaction: Ticket created by CXW > Queue: Getargs-Mixed > Subject: Getargs::Mixed won't accept undef as the value of a parameter > Broken in: 1.03 > Severity: (no value) > Owner: Nobody > Requestors: CXW@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=128428 > > > > Sterling, > > Thanks for Getargs::Mixed, which I am using and enjoying. I would like to > be able to pass `undef` as the value of a parameter. However, > Getargs::Mixed sees that as a missing parameter. Test case (Perl 5.26.3, > Cygwin x64): > > $ perl -E 'use strict; > use warnings; > use Getargs::Mixed; > use Data::Dumper; > my @in = ("-foo", undef); > say Dumper(\@in); # two elements > my (%args) = parameters([qw(foo)], @in); > say Dumper(\%args)' > $VAR1 = [ > '-foo', > undef > ]; > > Missing these required arguments: foo at > /home/cxw/perl5/lib/perl5/Getargs/Mixed.pm line 235. > Getargs::Mixed::parameters(ARRAY(0x600070618), "-foo", undef) > called at -e line 7 > > I believe this is because > https://metacpan.org/source/HANENKAMP/Getargs-Mixed-1.03/Mixed.pm#L234 > tests for definedness, not existence. I copied Getargs::Mixed and changed > only that line from `grep { !defined ...` to `grep { !exists ...`, with the > following result: > > $ perl -E 'use strict; > use warnings; > use Arrrgs; # My tweaked test module > use Data::Dumper; > my @in = ("-foo", undef); > say Dumper(\@in); # two elements > my (%args) = parameters([qw(foo)], @in); > say Dumper(\%args)' > $VAR1 = [ > '-foo', > undef > ]; > > $VAR1 = { > 'foo' => undef > }; > > I re-ran the Getargs::Mixed test suite with this change, and all tests > passed. > > Would you be willing to consider adding this change to the distribution? > Please let me know if you would like more information, tests, examples, or > code. Thank you! > > Sincerely, > Chris White (CXW) >
-- Andrew Sterling Hanenkamp sterling@hanenkamp.com 785.370.4454
Subject: Re: [rt.cpan.org #128428] Getargs::Mixed won't accept undef as the value of a parameter
Date: Thu, 7 Feb 2019 21:45:53 -0500
To: bug-Getargs-Mixed [...] rt.cpan.org
From: Christopher White <cxwembedded [...] gmail.com>
Thanks! If you're willing to give me the CPAN bit, I'd be happy to set up a repo, make the change, and upload. If I open a repo on GitHub, would you like META to point to GH issues, or keep RT as the primary bug system? I had one other thought --- would it be better for downstream code to leave the existing behaviour as is? This ticket could instead be fixed in an OO interface with settable options. Similar to the Data::Dumper approach --- parameters() would stay as is, and someone wanting the new behaviour could say my (%args) = Getargs::Mixed->new(undef_ok=>1)->parse([...], @_); or some such. Then there would be no risk of downstream breakage. Any thoughts or preferences? Much appreciated! On 2/6/19, sterling@hanenkamp.com via RT <bug-Getargs-Mixed@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=128428 > > > PRs are welcome. Unfortunately on this one, the last release predates > github, it predates the invention of git by a couple years. In fact, I > doubt I even have the original repo stored anymore, so I probably need to > create a new one forked by gitpan. Either that, or I'd be willing to give > you a maintainer flag in PAUSE so you can make the change and release it > yourself to CPAN. If I do it, I'll have to retool the thing to use my > modern development kit, which isn't hard, but time consuming enough that it > might get put off indefinitely given all the other random things I'm doing > in my O(fun) time. > > Cheers. > > On Tue, Feb 5, 2019 at 7:02 PM Christopher White via RT < > bug-Getargs-Mixed@rt.cpan.org> wrote: >
>> Tue Feb 05 20:02:25 2019: Request 128428 was acted upon. >> Transaction: Ticket created by CXW >> Queue: Getargs-Mixed >> Subject: Getargs::Mixed won't accept undef as the value of a >> parameter >> Broken in: 1.03 >> Severity: (no value) >> Owner: Nobody >> Requestors: CXW@cpan.org >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=128428 > >> >> >> Sterling, >> >> Thanks for Getargs::Mixed, which I am using and enjoying. I would like >> to >> be able to pass `undef` as the value of a parameter. However, >> Getargs::Mixed sees that as a missing parameter. Test case (Perl 5.26.3, >> Cygwin x64): >> >> $ perl -E 'use strict; >> use warnings; >> use Getargs::Mixed; >> use Data::Dumper; >> my @in = ("-foo", undef); >> say Dumper(\@in); # two elements >> my (%args) = parameters([qw(foo)], @in); >> say Dumper(\%args)' >> $VAR1 = [ >> '-foo', >> undef >> ]; >> >> Missing these required arguments: foo at >> /home/cxw/perl5/lib/perl5/Getargs/Mixed.pm line 235. >> Getargs::Mixed::parameters(ARRAY(0x600070618), "-foo", undef) >> called at -e line 7 >> >> I believe this is because >> https://metacpan.org/source/HANENKAMP/Getargs-Mixed-1.03/Mixed.pm#L234 >> tests for definedness, not existence. I copied Getargs::Mixed and >> changed >> only that line from `grep { !defined ...` to `grep { !exists ...`, with >> the >> following result: >> >> $ perl -E 'use strict; >> use warnings; >> use Arrrgs; # My tweaked test module >> use Data::Dumper; >> my @in = ("-foo", undef); >> say Dumper(\@in); # two elements >> my (%args) = parameters([qw(foo)], @in); >> say Dumper(\%args)' >> $VAR1 = [ >> '-foo', >> undef >> ]; >> >> $VAR1 = { >> 'foo' => undef >> }; >> >> I re-ran the Getargs::Mixed test suite with this change, and all tests >> passed. >> >> Would you be willing to consider adding this change to the distribution? >> Please let me know if you would like more information, tests, examples, >> or >> code. Thank you! >> >> Sincerely, >> Chris White (CXW) >>
> > > -- > Andrew Sterling Hanenkamp > sterling@hanenkamp.com > 785.370.4454 >
RT-Send-CC: sterling [...] hanenkamp.com
https://github.com/cxw42/Getargs-Mixed I got a bit gung-ho :) . On Thu Feb 07 21:46:02 2019, cxwembedded@gmail.com wrote: Show quoted text
> Thanks! If you're willing to give me the CPAN bit, I'd be happy to > set up a repo, make the change, and upload. > > If I open a repo on GitHub, would you like META to point to GH issues, > or keep RT as the primary bug system? > > I had one other thought --- would it be better for downstream code to > leave the existing behaviour as is? This ticket could instead be > fixed in an OO interface with settable options. Similar to the > Data::Dumper approach --- parameters() would stay as is, and someone > wanting the new behaviour could say > > my (%args) = Getargs::Mixed->new(undef_ok=>1)->parse([...], @_); > > or some such. Then there would be no risk of downstream breakage. > Any thoughts or preferences? Much appreciated! > > On 2/6/19, sterling@hanenkamp.com via RT <bug-Getargs- > Mixed@rt.cpan.org> wrote:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=128428 > > > > > PRs are welcome. Unfortunately on this one, the last release predates > > github, it predates the invention of git by a couple years. In fact, > > I > > doubt I even have the original repo stored anymore, so I probably > > need to > > create a new one forked by gitpan. Either that, or I'd be willing to > > give > > you a maintainer flag in PAUSE so you can make the change and release > > it > > yourself to CPAN. If I do it, I'll have to retool the thing to use my > > modern development kit, which isn't hard, but time consuming enough > > that it > > might get put off indefinitely given all the other random things I'm > > doing > > in my O(fun) time. > > > > Cheers. > > > > On Tue, Feb 5, 2019 at 7:02 PM Christopher White via RT < > > bug-Getargs-Mixed@rt.cpan.org> wrote: > >
> >> Tue Feb 05 20:02:25 2019: Request 128428 was acted upon. > >> Transaction: Ticket created by CXW > >> Queue: Getargs-Mixed > >> Subject: Getargs::Mixed won't accept undef as the value of a > >> parameter > >> Broken in: 1.03 > >> Severity: (no value) > >> Owner: Nobody > >> Requestors: CXW@cpan.org > >> Status: new > >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=128428 > > >> > >> > >> Sterling, > >> > >> Thanks for Getargs::Mixed, which I am using and enjoying. I would > >> like > >> to > >> be able to pass `undef` as the value of a parameter. However, > >> Getargs::Mixed sees that as a missing parameter. Test case (Perl > >> 5.26.3, > >> Cygwin x64): > >> > >> $ perl -E 'use strict; > >> use warnings; > >> use Getargs::Mixed; > >> use Data::Dumper; > >> my @in = ("-foo", undef); > >> say Dumper(\@in); # two elements > >> my (%args) = parameters([qw(foo)], @in); > >> say Dumper(\%args)' > >> $VAR1 = [ > >> '-foo', > >> undef > >> ]; > >> > >> Missing these required arguments: foo at > >> /home/cxw/perl5/lib/perl5/Getargs/Mixed.pm line 235. > >> Getargs::Mixed::parameters(ARRAY(0x600070618), "-foo", > >> undef) > >> called at -e line 7 > >> > >> I believe this is because > >> https://metacpan.org/source/HANENKAMP/Getargs-Mixed- > >> 1.03/Mixed.pm#L234 > >> tests for definedness, not existence. I copied Getargs::Mixed and > >> changed > >> only that line from `grep { !defined ...` to `grep { !exists ...`, > >> with > >> the > >> following result: > >> > >> $ perl -E 'use strict; > >> use warnings; > >> use Arrrgs; # My tweaked test module > >> use Data::Dumper; > >> my @in = ("-foo", undef); > >> say Dumper(\@in); # two elements > >> my (%args) = parameters([qw(foo)], @in); > >> say Dumper(\%args)' > >> $VAR1 = [ > >> '-foo', > >> undef > >> ]; > >> > >> $VAR1 = { > >> 'foo' => undef > >> }; > >> > >> I re-ran the Getargs::Mixed test suite with this change, and all > >> tests > >> passed. > >> > >> Would you be willing to consider adding this change to the > >> distribution? > >> Please let me know if you would like more information, tests, > >> examples, > >> or > >> code. Thank you! > >> > >> Sincerely, > >> Chris White (CXW) > >>
> > > > > > -- > > Andrew Sterling Hanenkamp > > sterling@hanenkamp.com > > 785.370.4454 > >
Subject: Re: [rt.cpan.org #128428] Getargs::Mixed won't accept undef as the value of a parameter
Date: Sat, 9 Feb 2019 17:56:16 -0600
To: bug-Getargs-Mixed [...] rt.cpan.org
From: Sterling Hanenkamp <sterling [...] hanenkamp.com>
Great. You are no co-maintainer. I'll even transfer ownership to you if you want it. I really don't have a preference when it comes to how bugs should be reported. I tend to let them be reported wherever without making a fuss personally. Cheers. On Fri, Feb 8, 2019 at 1:26 PM Christopher White via RT < bug-Getargs-Mixed@rt.cpan.org> wrote: Show quoted text
> Queue: Getargs-Mixed > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=128428 > > > https://github.com/cxw42/Getargs-Mixed > > I got a bit gung-ho :) . > > On Thu Feb 07 21:46:02 2019, cxwembedded@gmail.com wrote:
> > Thanks! If you're willing to give me the CPAN bit, I'd be happy to > > set up a repo, make the change, and upload. > > > > If I open a repo on GitHub, would you like META to point to GH issues, > > or keep RT as the primary bug system? > > > > I had one other thought --- would it be better for downstream code to > > leave the existing behaviour as is? This ticket could instead be > > fixed in an OO interface with settable options. Similar to the > > Data::Dumper approach --- parameters() would stay as is, and someone > > wanting the new behaviour could say > > > > my (%args) = Getargs::Mixed->new(undef_ok=>1)->parse([...], @_); > > > > or some such. Then there would be no risk of downstream breakage. > > Any thoughts or preferences? Much appreciated! > > > > On 2/6/19, sterling@hanenkamp.com via RT <bug-Getargs- > > Mixed@rt.cpan.org> wrote:
> > > <URL: https://rt.cpan.org/Ticket/Display.html?id=128428 > > > > > > > PRs are welcome. Unfortunately on this one, the last release predates > > > github, it predates the invention of git by a couple years. In fact, > > > I > > > doubt I even have the original repo stored anymore, so I probably > > > need to > > > create a new one forked by gitpan. Either that, or I'd be willing to > > > give > > > you a maintainer flag in PAUSE so you can make the change and release > > > it > > > yourself to CPAN. If I do it, I'll have to retool the thing to use my > > > modern development kit, which isn't hard, but time consuming enough > > > that it > > > might get put off indefinitely given all the other random things I'm > > > doing > > > in my O(fun) time. > > > > > > Cheers. > > > > > > On Tue, Feb 5, 2019 at 7:02 PM Christopher White via RT < > > > bug-Getargs-Mixed@rt.cpan.org> wrote: > > >
> > >> Tue Feb 05 20:02:25 2019: Request 128428 was acted upon. > > >> Transaction: Ticket created by CXW > > >> Queue: Getargs-Mixed > > >> Subject: Getargs::Mixed won't accept undef as the value of a > > >> parameter > > >> Broken in: 1.03 > > >> Severity: (no value) > > >> Owner: Nobody > > >> Requestors: CXW@cpan.org > > >> Status: new > > >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=128428 > > > >> > > >> > > >> Sterling, > > >> > > >> Thanks for Getargs::Mixed, which I am using and enjoying. I would > > >> like > > >> to > > >> be able to pass `undef` as the value of a parameter. However, > > >> Getargs::Mixed sees that as a missing parameter. Test case (Perl > > >> 5.26.3, > > >> Cygwin x64): > > >> > > >> $ perl -E 'use strict; > > >> use warnings; > > >> use Getargs::Mixed; > > >> use Data::Dumper; > > >> my @in = ("-foo", undef); > > >> say Dumper(\@in); # two elements > > >> my (%args) = parameters([qw(foo)], @in); > > >> say Dumper(\%args)' > > >> $VAR1 = [ > > >> '-foo', > > >> undef > > >> ]; > > >> > > >> Missing these required arguments: foo at > > >> /home/cxw/perl5/lib/perl5/Getargs/Mixed.pm line 235. > > >> Getargs::Mixed::parameters(ARRAY(0x600070618), "-foo", > > >> undef) > > >> called at -e line 7 > > >> > > >> I believe this is because > > >> https://metacpan.org/source/HANENKAMP/Getargs-Mixed- > > >> 1.03/Mixed.pm#L234 > > >> tests for definedness, not existence. I copied Getargs::Mixed and > > >> changed > > >> only that line from `grep { !defined ...` to `grep { !exists ...`, > > >> with > > >> the > > >> following result: > > >> > > >> $ perl -E 'use strict; > > >> use warnings; > > >> use Arrrgs; # My tweaked test module > > >> use Data::Dumper; > > >> my @in = ("-foo", undef); > > >> say Dumper(\@in); # two elements > > >> my (%args) = parameters([qw(foo)], @in); > > >> say Dumper(\%args)' > > >> $VAR1 = [ > > >> '-foo', > > >> undef > > >> ]; > > >> > > >> $VAR1 = { > > >> 'foo' => undef > > >> }; > > >> > > >> I re-ran the Getargs::Mixed test suite with this change, and all > > >> tests > > >> passed. > > >> > > >> Would you be willing to consider adding this change to the > > >> distribution? > > >> Please let me know if you would like more information, tests, > > >> examples, > > >> or > > >> code. Thank you! > > >> > > >> Sincerely, > > >> Chris White (CXW) > > >>
> > > > > > > > > -- > > > Andrew Sterling Hanenkamp > > > sterling@hanenkamp.com > > > 785.370.4454 > > >
>
-- Andrew Sterling Hanenkamp sterling@hanenkamp.com 785.370.4454
RT-Send-CC: sterling [...] hanenkamp.com
Thank you! I have uploaded 1.03_1 with the fix. I will bump to 1.04 and close this ticket once the cpantesters reports are in. I have no need for ownership, myself, but leave it to your discretion. On Sat Feb 09 18:56:39 2019, sterling@hanenkamp.com wrote: Show quoted text
> Great. You are no co-maintainer. I'll even transfer ownership to you if you > want it. I really don't have a preference when it comes to how bugs should > be reported. I tend to let them be reported wherever without making a fuss > personally. > > Cheers. >
<rest of chain cut>