change#5905 wasn't quite right--it's intent only applies when arguments
[p5sagit/p5-mst-13.2.git] / lib / Getopt / Long.pm
index f9aa2e5..f474c7c 100644 (file)
@@ -36,7 +36,7 @@ BEGIN {
     require 5.004;
     use Exporter ();
     use vars     qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-    $VERSION     = "2.22";
+    $VERSION     = "2.23";
 
     @ISA         = qw(Exporter);
     @EXPORT      = qw(&GetOptions $REQUIRE_ORDER $PERMUTE $RETURN_IN_ORDER);
@@ -108,12 +108,12 @@ __END__
 
 ################ AutoLoading subroutines ################
 
-# RCS Status      : $Id: GetoptLongAl.pl,v 2.26 2000-03-14 21:32:05+01 jv Exp $
+# RCS Status      : $Id: GetoptLongAl.pl,v 2.27 2000-03-17 09:07:26+01 jv Exp $
 # Author          : Johan Vromans
 # Created On      : Fri Mar 27 11:50:30 1998
 # Last Modified By: Johan Vromans
-# Last Modified On: Tue Mar 14 21:09:46 2000
-# Update Count    : 50
+# Last Modified On: Fri Mar 17 09:00:09 2000
+# Update Count    : 55
 # Status          : Released
 
 sub GetOptions {
@@ -137,7 +137,7 @@ sub GetOptions {
     print STDERR ("GetOpt::Long $Getopt::Long::VERSION ",
                  "called from package \"$pkg\".",
                  "\n  ",
-                 'GetOptionsAl $Revision: 2.26 $ ',
+                 'GetOptionsAl $Revision: 2.27 $ ',
                  "\n  ",
                  "ARGV: (@ARGV)",
                  "\n  ",
@@ -423,8 +423,10 @@ sub GetOptions {
                            &{$linkage{$opt}}($opt, $arg);
                        };
                        print STDERR ("=> die($@)\n") if $debug && $@ ne '';
-                       if ( $@ =~ /^FINISH\b/ ) {
-                           $goon = 0;
+                       if ( $@ =~ /^!/ ) {
+                           if ( $@ =~ /^!FINISH\b/ ) {
+                               $goon = 0;
+                           }
                        }
                        elsif ( $@ ne '' ) {
                            warn ($@);
@@ -491,8 +493,10 @@ sub GetOptions {
                    &$cb ($tryopt);
                };
                print STDERR ("=> die($@)\n") if $debug && $@ ne '';
-               if ( $@ =~ /^FINISH\b/ ) {
-                   $goon = 0;
+               if ( $@ =~ /^!/ ) {
+                   if ( $@ =~ /^!FINISH\b/ ) {
+                       $goon = 0;
+                   }
                }
                elsif ( $@ ne '' ) {
                    warn ($@);
@@ -1129,10 +1133,10 @@ the desired error message as its argument. GetOptions() will catch the
 die(), issue the error message, and record that an error result must
 be returned upon completion.
 
-It is also possible for a user-defined subroutine to preliminary
-terminate options processing by calling die() with argument
-C<"FINISH">. GetOptions will react as if it encountered a double dash
-C<-->.
+If the text of the error message starts with an exclamantion mark C<!>
+it is interpreted specially by GetOptions(). There is currently one
+special command implemented: C<die("!FINISH")> will cause GetOptions()
+to stop processing options, as if it encountered a double dash C<-->.
 
 =head2 Options with multiple names