summaryrefslogtreecommitdiff
path: root/lib/SelfLoader.pm
diff options
context:
space:
mode:
authorAdriano Ferreira <a.r.ferreira@gmail.com>2006-08-24 07:20:43 -0300
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-08-25 15:58:41 +0000
commitcca8f13b7a786baee2df1fba298a1923907c3bad (patch)
treec83c00d73e8248e09274d912e05101b0841739f4 /lib/SelfLoader.pm
parent2b9198b74d2a4d85eb2f4f75689dee7f3e19e146 (diff)
downloadperl-cca8f13b7a786baee2df1fba298a1923907c3bad.tar.gz
Re: [perl #40216] SelfLoader::croak doesn't protect $@ from being clobbered by require
From: "Adriano Ferreira" <a.r.ferreira@gmail.com> Message-ID: <73ddeb6c0608240620s207124d1mc202aea6a4598576@mail.gmail.com> p4raw-id: //depot/perl@28758
Diffstat (limited to 'lib/SelfLoader.pm')
-rw-r--r--lib/SelfLoader.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/SelfLoader.pm b/lib/SelfLoader.pm
index 87587c31be..294b6bc6b0 100644
--- a/lib/SelfLoader.pm
+++ b/lib/SelfLoader.pm
@@ -16,8 +16,10 @@ $nested = qr{ \( (?: (?> [^()]+ ) | (??{ $nested }) )* \) }x;
our $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x;
our $attr_list = qr{ \s* : \s* (?: $one_attr )* }x;
-sub croak { require Carp; goto &Carp::croak }
-sub carp { require Carp; goto &Carp::carp }
+# in croak and carp, protect $@ from "require Carp;" RT #40216
+
+sub croak { { local $@; require Carp; } goto &Carp::croak }
+sub carp { { local $@; require Carp; } goto &Carp::carp }
AUTOLOAD {
print STDERR "SelfLoader::AUTOLOAD for $AUTOLOAD\n" if $DEBUG;