summaryrefslogtreecommitdiff
path: root/cpan/Getopt-Long
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2015-02-23 19:41:50 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2015-02-23 19:41:50 +0000
commitc7e74775aeccc7506df4216c4a137b2c702187fc (patch)
tree7c9d90d8777a0926351da35be0fabb8ae4fc6521 /cpan/Getopt-Long
parentf4460c6f7a0de152ddaed69a0ba0efe653258f81 (diff)
downloadperl-c7e74775aeccc7506df4216c4a137b2c702187fc.tar.gz
Update Getopt-Long to CPAN version 2.45
[DELTA] Changes in version 2.45 ----------------------- * Revert behaviour of the combination of <> and pass_through to what is was in 2.42. Thanks to Wilson Snyder to provide enhancements to the documentation to clarify why <> and pass_through generally is a bad idea. It is, however, very unfortunate to hear from users that their programs *depend* on the undocumented pre-2.43 behaviour.
Diffstat (limited to 'cpan/Getopt-Long')
-rw-r--r--cpan/Getopt-Long/lib/Getopt/Long.pm35
-rw-r--r--cpan/Getopt-Long/t/gol-linkage.t30
2 files changed, 44 insertions, 21 deletions
diff --git a/cpan/Getopt-Long/lib/Getopt/Long.pm b/cpan/Getopt-Long/lib/Getopt/Long.pm
index 8a99db9288..154c008d3a 100644
--- a/cpan/Getopt-Long/lib/Getopt/Long.pm
+++ b/cpan/Getopt-Long/lib/Getopt/Long.pm
@@ -4,8 +4,8 @@
# Author : Johan Vromans
# Created On : Tue Sep 11 15:00:12 1990
# Last Modified By: Johan Vromans
-# Last Modified On: Thu Feb 19 09:15:53 2015
-# Update Count : 1682
+# Last Modified On: Mon Feb 23 20:29:11 2015
+# Update Count : 1683
# Status : Released
################ Module Preamble ################
@@ -17,10 +17,10 @@ use 5.004;
use strict;
use vars qw($VERSION);
-$VERSION = 2.44;
+$VERSION = 2.45;
# For testing versions only.
use vars qw($VERSION_STRING);
-$VERSION_STRING = "2.44";
+$VERSION_STRING = "2.45";
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK);
@@ -373,11 +373,6 @@ sub GetOptionsFromArray(@) {
next;
}
$linkage{'<>'} = shift (@optionlist);
- if ( $passthrough ) {
- # Too harsh... for now.
- # $error .= "Option spec <> cannot be used with pass_through\n";
- warn("Option spec <> cannot be used with pass_through. FIX IT!\n");
- }
next;
}
@@ -723,7 +718,7 @@ sub GetOptionsFromArray(@) {
elsif ( $order == $PERMUTE ) {
# Try non-options call-back.
my $cb;
- if ( !$passthrough && (defined ($cb = $linkage{'<>'})) ) {
+ if ( defined ($cb = $linkage{'<>'}) ) {
print STDERR ("=> &L{$tryopt}(\"$tryopt\")\n")
if $debug;
my $eval_error = do {
@@ -2451,22 +2446,22 @@ C<require> statement.
=item pass_through (default: disabled)
-Anything that is unknown, ambiguous or supplied with an invalid option
-value is passed through in C<@ARGV> instead of being flagged as
-errors. This makes it possible to write wrapper scripts that process
-only part of the user supplied command line arguments, and pass the
+With C<pass_through> anything that is unknown, ambiguous or supplied with
+an invalid option will not be flagged as an error. Instead the unknown
+option(s) will be passed to the catchall C<< <> >> if present, otherwise
+through to C<@ARGV>. This makes it possible to write wrapper scripts that
+process only part of the user supplied command line arguments, and pass the
remaining options to some other program.
-If C<require_order> is enabled, options processing will terminate at
-the first unrecognized option, or non-option, whichever comes first.
-However, if C<permute> is enabled instead, results can become confusing.
+If C<require_order> is enabled, options processing will terminate at the
+first unrecognized option, or non-option, whichever comes first and all
+remaining arguments are passed to C<@ARGV> instead of the catchall
+C<< <> >> if present. However, if C<permute> is enabled instead, results
+can become confusing.
Note that the options terminator (default C<-->), if present, will
also be passed through in C<@ARGV>.
-For obvious reasons, B<pass_through> cannot be used with the
-non-option catchall C<< <> >>.
-
=item prefix
The string that starts options. If a constant string is not
diff --git a/cpan/Getopt-Long/t/gol-linkage.t b/cpan/Getopt-Long/t/gol-linkage.t
index df975c8b31..d4b526b09e 100644
--- a/cpan/Getopt-Long/t/gol-linkage.t
+++ b/cpan/Getopt-Long/t/gol-linkage.t
@@ -11,7 +11,7 @@ BEGIN {
use Getopt::Long;
-print "1..33\n";
+print "1..37\n";
@ARGV = qw(-Foo -baR --foo bar);
Getopt::Long::Configure ("no_ignore_case");
@@ -91,3 +91,31 @@ print (!(exists $lnk{bar}) ? "" : "not ", "ok 28\n");
package Overload::Test;
use overload '""' => sub{ die "Bad mojo!" };
}
+
+{
+ @ARGV = (qw[-thru -here -more 1]);
+ my $got = "";
+ Getopt::Long::Configure("default");
+ Getopt::Long::Configure("pass_through");
+ print "not" unless GetOptions
+ ("here" => sub { $got .= " sub_here"; },
+ "<>" => sub { $got .= " <>=".$_[0]; }, );
+ $got .= " remain=".join(',',@ARGV);
+ print "ok 34\n";
+ print +(($got eq " <>=-thru sub_here <>=-more <>=1 remain=")
+ ? "" : "not ", "ok 35\n");
+}
+
+{
+ @ARGV = (qw[-thru -here -more -- 1]);
+ my $got = "";
+ Getopt::Long::Configure("default");
+ Getopt::Long::Configure("pass_through","require_order");
+ print "not" unless GetOptions
+ ("here" => sub { $got .= " sub_here"; },
+ "<>" => sub { $got .= " <>=".$_[0]; }, );
+ $got .= " remain=".join(',',@ARGV);
+ print "ok 36\n";
+ print +(($got eq " remain=-thru,-here,-more,--,1")
+ ? "" : "not ", "ok 37\n");
+}