In overload::AddrRef, use ‘no overloading’
authorFather Chrysostomos <sprout@cpan.org>
Wed, 18 Jan 2012 21:03:32 +0000 (13:03 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 24 Jan 2012 18:35:48 +0000 (10:35 -0800)
This speeds this up by about 13 times.

lib/overload.pm

index 90463b3..77dfa66 100644 (file)
@@ -113,17 +113,8 @@ sub Method {
 }
 
 sub AddrRef {
-  my $package = ref $_[0];
-  return "$_[0]" unless $package;
-
-  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("%s%s(0x%x)", $class_prefix, $type, $addr);
+  no overloading;
+  "$_[0]";
 }
 
 *StrVal = *AddrRef;