summaryrefslogtreecommitdiff
path: root/lib/Getopt
diff options
context:
space:
mode:
authorRobin Barker <RMBarker@cpan.org>1998-06-30 15:45:49 +0100
committerGurusamy Sarathy <gsar@cpan.org>1998-07-04 03:16:39 +0000
commit6ca643772c15e04b8f848ca017ebb52a60532b2b (patch)
treead15fe759951e7ae7329c96d394b8754f5bd11b9 /lib/Getopt
parent49399b3f940d44418e30fbc3c7271b5d4ee63620 (diff)
downloadperl-6ca643772c15e04b8f848ca017ebb52a60532b2b.tar.gz
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
Diffstat (limited to 'lib/Getopt')
-rw-r--r--lib/Getopt/Std.pm16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Getopt/Std.pm b/lib/Getopt/Std.pm
index 18b5739e92..c2cd1234f4 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;
}