summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-05-07 13:38:24 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-05-07 13:38:24 +0000
commit150ffd395f221403ba49c4cd1c17da7e3f7adc59 (patch)
tree5caf9dfdc2a671e94fafa55b72c4d92bd8b557a6 /lib
parent50109ad0d28b27abe5ee82def070e14b4526321c (diff)
downloadperl-150ffd395f221403ba49c4cd1c17da7e3f7adc59.tar.gz
Fix [perl #42163] "use base" masks $SIG{__DIE__}
adapted from a patch by Michael G Schwern p4raw-id: //depot/perl@31163
Diffstat (limited to 'lib')
-rw-r--r--lib/base.pm27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/base.pm b/lib/base.pm
index d8baa95d0a..8bcbb5f3ca 100644
--- a/lib/base.pm
+++ b/lib/base.pm
@@ -2,7 +2,7 @@ package base;
use strict 'vars';
use vars qw($VERSION);
-$VERSION = '2.08';
+$VERSION = '2.09';
# constant.pm is slow
sub SUCCESS () { 1 }
@@ -82,19 +82,24 @@ sub import {
unless defined ${$base.'::VERSION'};
}
else {
- local $SIG{__DIE__};
- eval "require $base";
- # Only ignore "Can't locate" errors from our eval require.
- # Other fatal errors (syntax etc) must be reported.
- die if $@ && $@ !~ /^Can't locate .*? at \(eval /;
- unless (%{"$base\::"}) {
- require Carp;
- Carp::croak(<<ERROR);
+ my $sigdie;
+ {
+ local $SIG{__DIE__};
+ eval "require $base";
+ # Only ignore "Can't locate" errors from our eval require.
+ # Other fatal errors (syntax etc) must be reported.
+ die if $@ && $@ !~ /^Can't locate .*? at \(eval /;
+ unless (%{"$base\::"}) {
+ require Carp;
+ Carp::croak(<<ERROR);
Base class package "$base" is empty.
(Perhaps you need to 'use' the module which defines that package first.)
ERROR
-
- }
+ }
+ $sigdie = $SIG{__DIE__};
+ }
+ # Make sure a global $SIG{__DIE__} makes it out of the localization.
+ $SIG{__DIE__} = $sigdie if defined $sigdie;
${$base.'::VERSION'} = "-1, set by base.pm"
unless defined ${$base.'::VERSION'};
}