Skip to content

Commit

Permalink
Fix bug RT#114999
Browse files Browse the repository at this point in the history
* fixes [RT#114999](https://rt.cpan.org/Ticket/Display.html?id=114999)
* 'gnu_compat' mode single character options with optional arguments and default values
  now return correct values when used with no argument from the CLI
  • Loading branch information
rivy committed Jun 7, 2016
1 parent 13ec4f8 commit 5d9947f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Getopt/Long.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ sub FindOption ($$$$$) {
if ( $gnu_compat ) {
my $optargtype = 0; # 0 = none, 1 = empty, 2 = nonempty
$optargtype = ( !defined($optarg) ? 0 : ( (length($optarg) == 0) ? 1 : 2 ) );
return (1, $opt, $ctl, undef)
return (1, $opt, $ctl, defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT] : undef)
if (($optargtype == 0) && !$mand);
return (1, $opt, $ctl, $type eq 's' ? '' : 0)
if $optargtype == 1; # --foo= -> return nothing
Expand Down

0 comments on commit 5d9947f

Please sign in to comment.