X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Foverload.pm;h=c02fddbfab2e5243b4bb89aab8fcc67cbd45853d;hb=f3828575f121139b95363dc2ba6aab15ad201a85;hp=db201fa78fb55e199fbcac7d8861122424d0a43d;hpb=6b14e5b9025a1b2de53ba9158f044abe6bf49180;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/overload.pm b/lib/overload.pm index db201fa..c02fddb 100644 --- a/lib/overload.pm +++ b/lib/overload.pm @@ -2,8 +2,6 @@ package overload; our $VERSION = '1.06'; -require Scalar::Util; - sub nil {} sub OVERLOAD { @@ -75,6 +73,9 @@ sub OverloadedStringify { sub Method { my $package = shift; if(ref $package) { + local $@; + local $!; + require Scalar::Util; $package = Scalar::Util::blessed($package); return undef if !defined $package; } @@ -88,12 +89,14 @@ sub AddrRef { my $package = ref $_[0]; return "$_[0]" unless $package; - require Scalar::Util; - my $class = Scalar::Util::blessed($_[0]); - my $class_prefix = defined($class) ? "$class=" : ""; - my $type = Scalar::Util::reftype($_[0]); - my $addr = Scalar::Util::refaddr($_[0]); - return sprintf("$class_prefix$type(0x%x)", $addr); + local $@; + local $!; + require Scalar::Util; + my $class = Scalar::Util::blessed($_[0]); + my $class_prefix = defined($class) ? "$class=" : ""; + my $type = Scalar::Util::reftype($_[0]); + my $addr = Scalar::Util::refaddr($_[0]); + return sprintf("$class_prefix$type(0x%x)", $addr); } *StrVal = *AddrRef;