summaryrefslogtreecommitdiff
path: root/cpan/Getopt-Long
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2017-06-15 12:35:17 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2017-06-15 12:35:17 +0100
commitbdb1f1b3738d343c9d3048636256f9d44854d329 (patch)
tree355114afe25dc2837ee03cdc5d07d029af82dd55 /cpan/Getopt-Long
parent874389ae053832437addcb8d34e734a61d519323 (diff)
downloadperl-bdb1f1b3738d343c9d3048636256f9d44854d329.tar.gz
Update Getopt-Long to CPAN version 2.50
[DELTA] Changes in version 2.50 ----------------------- * Fix bug https://rt.cpan.org/Ticket/Display.html?id=120231. * Fix bug https://rt.cpan.org/Ticket/Display.html?id=120300. Unfortunately, this withdraws a small part of fix 114999. GNU getopt_long() does not accept the (optional) argument to be passed to the option without = sign. We do, since not doing so breaks existing scripts. * Provide a default value for options (gnu_compat mode). Thanks to Andrew Gregory.
Diffstat (limited to 'cpan/Getopt-Long')
-rw-r--r--cpan/Getopt-Long/lib/Getopt/Long.pm46
1 files changed, 32 insertions, 14 deletions
diff --git a/cpan/Getopt-Long/lib/Getopt/Long.pm b/cpan/Getopt-Long/lib/Getopt/Long.pm
index 5e1834f3ca..664c8b63c9 100644
--- a/cpan/Getopt-Long/lib/Getopt/Long.pm
+++ b/cpan/Getopt-Long/lib/Getopt/Long.pm
@@ -4,23 +4,24 @@
# Author : Johan Vromans
# Created On : Tue Sep 11 15:00:12 1990
# Last Modified By: Johan Vromans
-# Last Modified On: Thu Jun 9 14:50:37 2016
-# Update Count : 1699
+# Last Modified On: Sat May 27 12:11:39 2017
+# Update Count : 1715
# Status : Released
################ Module Preamble ################
-package Getopt::Long;
-
use 5.004;
use strict;
+use warnings;
+
+package Getopt::Long;
use vars qw($VERSION);
-$VERSION = 2.49;
+$VERSION = 2.50;
# For testing versions only.
use vars qw($VERSION_STRING);
-$VERSION_STRING = "2.49";
+$VERSION_STRING = "2.50";
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK);
@@ -1045,7 +1046,8 @@ sub FindOption ($$$$$) {
# Complete the option name, if appropriate.
if ( @hits == 1 && $hits[0] ne $opt ) {
$tryopt = $hits[0];
- $tryopt = lc ($tryopt) if $ignorecase;
+ $tryopt = lc ($tryopt)
+ if $ignorecase > (($bundling && length($tryopt) == 1) ? 1 : 0);
print STDERR ("=> option \"$opt\" -> \"$tryopt\"\n")
if $debug;
}
@@ -1110,10 +1112,23 @@ sub FindOption ($$$$$) {
# Check if there is an option argument available.
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, defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT] : undef)
- if (($optargtype == 0) && !$mand);
+ my $optargtype = 0; # none, 1 = empty, 2 = nonempty, 3 = aux
+ if ( defined($optarg) ) {
+ $optargtype = (length($optarg) == 0) ? 1 : 2;
+ }
+ elsif ( defined $rest || @$argv > 0 ) {
+ # GNU getopt_long() does not accept the (optional)
+ # argument to be passed to the option without = sign.
+ # We do, since not doing so breaks existing scripts.
+ $optargtype = 3;
+ }
+ if(($optargtype == 0) && !$mand) {
+ my $val
+ = defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT]
+ : $type eq 's' ? ''
+ : 0;
+ return (1, $opt, $ctl, $val);
+ }
return (1, $opt, $ctl, $type eq 's' ? '' : 0)
if $optargtype == 1; # --foo= -> return nothing
}
@@ -1753,12 +1768,12 @@ destination for the option:
GetOptions ("library=s" => \@libfiles);
Alternatively, you can specify that the option can have multiple
-values by adding a "@", and pass a scalar reference as the
+values by adding a "@", and pass a reference to a scalar as the
destination:
GetOptions ("library=s@" => \$libfiles);
-Used with the example above, C<@libfiles> (or C<@$libfiles>) would
+Used with the example above, C<@libfiles> c.q. C<@$libfiles> would
contain two strings upon completion: C<"lib/stdlib"> and
C<"lib/extlib">, in that order. It is also possible to specify that
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>,
C<--opt=> will give option C<opt> and empty value.
This is the way GNU getopt_long() does it.
+Note that C<--opt value> is still accepted, even though GNU
+getopt_long() doesn't.
+
=item gnu_getopt
This is a short way of setting C<gnu_compat> C<bundling> C<permute>
C<no_getopt_compat>. With C<gnu_getopt>, command line handling should be
-fully compatible with GNU getopt_long().
+reasonably compatible with GNU getopt_long().
=item require_order