Skip Menu |

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

Report information
The Basics
Id: 113748
Status: resolved
Priority: 0/
Queue: Getopt-Long

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

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



Subject: VersionMessage ignores -output argument
If you call the VersionMessage subroutine directly, the -output argument seems to be pretty much ignored. Reading the code, it looks like the intent was to compute the output handle by performing a '||' on the -output argument and the results of a '?:'. Unfortunately the '?:' binds more loosely than the '||' (see perlop), so the result is going to be either the second or third operand of the '?:' no matter what value is given for -output. The attached files are: * Getopt-Long.patch, a patch that restores what I believe is the intended functionality by placing parentheses around the trinary operation; * check, a small Perl script that demonstrates the behavior (or lack thereof). I would have done a test, but I was not brave (or foolish) enough to write a test that needs to run under Perl 5.004. I have called this unimportant because if it was causing anyone any serious problem you would have gotten a report on this long ago.
Subject: Getopt-Long.patch
--- lib/Getopt/Long.old 2016-04-13 13:19:47.000000000 -0400 +++ lib/Getopt/Long.pm 2016-04-13 13:56:03.000000000 -0400 @@ -1451,7 +1451,7 @@ my $v = $main::VERSION; my $fh = $pa->{-output} || - ($pa->{-exitval} eq "NOEXIT" || $pa->{-exitval} < 2) ? \*STDOUT : \*STDERR; + ( ($pa->{-exitval} eq "NOEXIT" || $pa->{-exitval} < 2) ? \*STDOUT : \*STDERR ); print $fh (defined($pa->{-message}) ? $pa->{-message} : (), $0, defined $v ? " version $v" : (),
Subject: check
Download check
application/octet-stream 1.7k

Message body not shown because it is not plain text.

Thanks, applied. (Will be included in the next release.)