From: Robin Barker Date: Tue, 30 Jun 1998 14:45:49 +0000 (+0100) Subject: tweaks to Getopt::Std X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6ca643772c15e04b8f848ca017ebb52a60532b2b;p=p5sagit%2Fp5-mst-13.2.git tweaks to Getopt::Std Message-Id: <14103.9806301345@tempest.cise.npl.co.uk> Subject: [PATCH perl5.004_69] lib/Getopt/Std.pm -- Message-Id: <17918.9807021053@tempest.cise.npl.co.uk> To: perl5-porters@perl.org Subject: [PATCH perl5.004_69] second: lib/Getopt/Std.pm p4raw-id: //depot/perl@1288 --- diff --git a/lib/Getopt/Std.pm b/lib/Getopt/Std.pm index 18b5739..c2cd123 100644 --- a/lib/Getopt/Std.pm +++ b/lib/Getopt/Std.pm @@ -57,7 +57,7 @@ the argument or 1 if no argument is specified. sub getopt ($;$) { local($argumentative, $hash) = @_; local($_,$first,$rest); - local $Exporter::ExportLevel; + local @EXPORT; while (@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) { ($first,$rest) = ($1,$2); @@ -93,8 +93,10 @@ sub getopt ($;$) { } } } - $Exporter::ExportLevel++; - import Getopt::Std; + unless (ref $hash) { + local $Exporter::ExportLevel = 1; + import Getopt::Std; + } } # Usage: @@ -105,7 +107,7 @@ sub getopts ($;$) { local($argumentative, $hash) = @_; local(@args,$_,$first,$rest); local($errs) = 0; - local $Exporter::ExportLevel; + local @EXPORT; @args = split( / */, $argumentative ); while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) { @@ -153,8 +155,10 @@ sub getopts ($;$) { } } } - $Exporter::ExportLevel++; - import Getopt::Std; + unless (ref $hash) { + local $Exporter::ExportLevel = 1; + import Getopt::Std; + } $errs == 0; }