Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit a40a86a

Browse files
committed
Getopt-Long: Update to 2.50
Fix bug L<https://rt.cpan.org/Ticket/Display.html?id=120231>. Fix bug L<https://rt.cpan.org/Ticket/Display.html?id=120300>. Unfortunately, this withdraws a small part of fix 114999. GNU C<getopt_long()> does not accept the (optional) argument to be passed to the option without C<=> sign. We do, since not doing so breaks existing scripts. Provide a default value for options (B<gnu_compat> mode). Thanks to Andrew Gregory.
1 parent d18d1a3 commit a40a86a

File tree

5 files changed

+49
-16
lines changed

5 files changed

+49
-16
lines changed

Porting/Maintainers.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ package Maintainers;
793793
},
794794

795795
'Getopt::Long' => {
796-
'DISTRIBUTION' => 'JV/Getopt-Long-2.49.tar.gz',
796+
'DISTRIBUTION' => 'JV/Getopt-Long-2.5.tar.gz',
797797
'FILES' => q[cpan/Getopt-Long],
798798
'EXCLUDED' => [
799799
qr{^examples/},

cpan/Getopt-Long/lib/Getopt/Long.pm

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
# Author : Johan Vromans
55
# Created On : Tue Sep 11 15:00:12 1990
66
# Last Modified By: Johan Vromans
7-
# Last Modified On: Thu Jun 9 14:50:37 2016
8-
# Update Count : 1699
7+
# Last Modified On: Sat May 27 12:11:39 2017
8+
# Update Count : 1715
99
# Status : Released
1010

1111
################ Module Preamble ################
1212

13-
package Getopt::Long;
14-
1513
use 5.004;
1614

1715
use strict;
16+
use warnings;
17+
18+
package Getopt::Long;
1819

1920
use vars qw($VERSION);
20-
$VERSION = 2.49;
21+
$VERSION = 2.50;
2122
# For testing versions only.
2223
use vars qw($VERSION_STRING);
23-
$VERSION_STRING = "2.49";
24+
$VERSION_STRING = "2.50";
2425

2526
use Exporter;
2627
use vars qw(@ISA @EXPORT @EXPORT_OK);
@@ -1045,7 +1046,8 @@ sub FindOption ($$$$$) {
10451046
# Complete the option name, if appropriate.
10461047
if ( @hits == 1 && $hits[0] ne $opt ) {
10471048
$tryopt = $hits[0];
1048-
$tryopt = lc ($tryopt) if $ignorecase;
1049+
$tryopt = lc ($tryopt)
1050+
if $ignorecase > (($bundling && length($tryopt) == 1) ? 1 : 0);
10491051
print STDERR ("=> option \"$opt\" -> \"$tryopt\"\n")
10501052
if $debug;
10511053
}
@@ -1110,10 +1112,23 @@ sub FindOption ($$$$$) {
11101112

11111113
# Check if there is an option argument available.
11121114
if ( $gnu_compat ) {
1113-
my $optargtype = 0; # 0 = none, 1 = empty, 2 = nonempty
1114-
$optargtype = ( !defined($optarg) ? 0 : ( (length($optarg) == 0) ? 1 : 2 ) );
1115-
return (1, $opt, $ctl, defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT] : undef)
1116-
if (($optargtype == 0) && !$mand);
1115+
my $optargtype = 0; # none, 1 = empty, 2 = nonempty, 3 = aux
1116+
if ( defined($optarg) ) {
1117+
$optargtype = (length($optarg) == 0) ? 1 : 2;
1118+
}
1119+
elsif ( defined $rest || @$argv > 0 ) {
1120+
# GNU getopt_long() does not accept the (optional)
1121+
# argument to be passed to the option without = sign.
1122+
# We do, since not doing so breaks existing scripts.
1123+
$optargtype = 3;
1124+
}
1125+
if(($optargtype == 0) && !$mand) {
1126+
my $val
1127+
= defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT]
1128+
: $type eq 's' ? ''
1129+
: 0;
1130+
return (1, $opt, $ctl, $val);
1131+
}
11171132
return (1, $opt, $ctl, $type eq 's' ? '' : 0)
11181133
if $optargtype == 1; # --foo= -> return nothing
11191134
}
@@ -1753,12 +1768,12 @@ destination for the option:
17531768
GetOptions ("library=s" => \@libfiles);
17541769
17551770
Alternatively, you can specify that the option can have multiple
1756-
values by adding a "@", and pass a scalar reference as the
1771+
values by adding a "@", and pass a reference to a scalar as the
17571772
destination:
17581773
17591774
GetOptions ("library=s@" => \$libfiles);
17601775
1761-
Used with the example above, C<@libfiles> (or C<@$libfiles>) would
1776+
Used with the example above, C<@libfiles> c.q. C<@$libfiles> would
17621777
contain two strings upon completion: C<"lib/stdlib"> and
17631778
C<"lib/extlib">, in that order. It is also possible to specify that
17641779
only integer or floating point numbers are acceptable values.
@@ -2322,11 +2337,14 @@ do. Without C<gnu_compat>, C<--opt=> gives an error. With C<gnu_compat>,
23222337
C<--opt=> will give option C<opt> and empty value.
23232338
This is the way GNU getopt_long() does it.
23242339
2340+
Note that C<--opt value> is still accepted, even though GNU
2341+
getopt_long() doesn't.
2342+
23252343
=item gnu_getopt
23262344
23272345
This is a short way of setting C<gnu_compat> C<bundling> C<permute>
23282346
C<no_getopt_compat>. With C<gnu_getopt>, command line handling should be
2329-
fully compatible with GNU getopt_long().
2347+
reasonably compatible with GNU getopt_long().
23302348
23312349
=item require_order
23322350

dist/Module-CoreList/lib/Module/CoreList.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14967,6 +14967,7 @@ our %delta = (
1496714967
'File::Spec::VMS' => '4.68',
1496814968
'File::Spec::Win32' => '4.68c',
1496914969
'Filter::Simple' => '0.94',
14970+
'Getopt::Long' => '2.50',
1497014971
'IO::Socket' => '1.38_01',
1497114972
'IO::Socket::INET' => '1.35_01',
1497214973
'IO::Socket::UNIX' => '1.26_01',
@@ -15133,6 +15134,7 @@ our %delta = (
1513315134
'File::Spec::VMS' => '4.68',
1513415135
'File::Spec::Win32' => '4.68c',
1513515136
'Filter::Simple' => '0.94',
15137+
'Getopt::Long' => '2.50',
1513615138
'IO::Socket' => '1.38_01',
1513715139
'IO::Socket::INET' => '1.35_01',
1513815140
'IO::Socket::UNIX' => '1.26_01',

pod/perlcdelta.pod

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,19 @@ Filter::Simple was erroneously signalling eof if it encountered a
370370
no MyFilter;
371371
In this case it should simply not filter anything.
372372

373+
=item L<Getopt::Long> 2.50
374+
375+
Fix bug L<https://rt.cpan.org/Ticket/Display.html?id=120231>.
376+
377+
Fix bug L<https://rt.cpan.org/Ticket/Display.html?id=120300>.
378+
Unfortunately, this withdraws a small part of fix 114999. GNU
379+
C<getopt_long()> does not accept the (optional) argument to be passed
380+
to the option without C<=> sign. We do, since not doing so breaks
381+
existing scripts.
382+
383+
Provide a default value for options (B<gnu_compat> mode).
384+
Thanks to Andrew Gregory.
385+
373386
=item L<IO>
374387

375388
Bump versions of 3 Socket modules.

t/porting/customized.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Math::BigInt cpan/Math-BigInt/t/upgrade.t 7c15cac7f321ca396648ec45da6389a1283e15
100100
Math::BigInt cpan/Math-BigInt/t/upgradef.t 06610e9883ce805bcd6543ab959a9826f598eb40
101101
Math::BigInt cpan/Math-BigInt/t/with_sub.t c040328e223df6f56250f5d67dcb2c9a2f23c110
102102
Memoize cpan/Memoize/t/expmod_t.t 9386100cd9c95a0e8a4e001bba3aa52eec114d21
103-
Module::CoreList dist/Module-CoreList/lib/Module/CoreList.pm 419c6a48cf3c07420d132da5fef5d46b6d68936b
103+
Module::CoreList dist/Module-CoreList/lib/Module/CoreList.pm 0d60afeb81ba2638974da150e1980071089c9c6e
104104
Module::CoreList dist/Module-CoreList/lib/Module/CoreList/Utils.pm 7ff05ce5f0b967d229b90870de806ce3fea82b22
105105
Module::Metadata cpan/Module-Metadata/t/lib/GeneratePackage.pm 502ffbe2609947430e6aa1a3df8064b3fef3e086
106106
Net::Domain cpan/libnet/lib/Net/Cmd.pm 70a007c38833667ad47ea8059c37c1b7d1c77b6c

0 commit comments

Comments
 (0)