This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In overload::ov_method, use ‘no overloading’
authorFather Chrysostomos <sprout@cpan.org>
Wed, 18 Jan 2012 18:57:44 +0000 (10:57 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 18 Jan 2012 18:57:44 +0000 (10:57 -0800)
Using this instead of Scalar::Util makes things marginally faster.

lib/overload.pm

index 865a712..a2797e7 100644 (file)
@@ -82,9 +82,8 @@ sub ov_method {
   my $globref = shift;
   return undef unless $globref;
   my $sub = \&{*$globref};
-  require Scalar::Util;
-  return $sub
-    if Scalar::Util::refaddr($sub) != Scalar::Util::refaddr(\&nil);
+  no overloading;
+  return $sub if !ref $sub or $sub != \&nil;
   return shift->can($ {*$globref});
 }