From: Jesse Luehrs Date: Thu, 8 Mar 2012 07:13:08 +0000 (-0600) Subject: factor this out into a private method X-Git-Tag: 2.0500~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=456105f51084862bf320f3b653a3ad7b4a7d0dbb;p=gitmo%2FMoose.git factor this out into a private method --- diff --git a/lib/Class/MOP/Mixin/HasMethods.pm b/lib/Class/MOP/Mixin/HasMethods.pm index f714cd5..aedd190 100644 --- a/lib/Class/MOP/Mixin/HasMethods.pm +++ b/lib/Class/MOP/Mixin/HasMethods.pm @@ -225,7 +225,7 @@ sub _overload_map { my %map; for my $op ($self->overload_operators) { - my $body = overload::Method($self->name, $op); + my $body = $self->_get_overloaded_operator_body($op); next unless defined $body; $map{$op} = $body; } @@ -247,13 +247,13 @@ sub get_overloaded_operators { sub has_overloaded_operator { my $self = shift; my ($op) = @_; - return defined overload::Method($self->name, $op); + return defined $self->_get_overloaded_operator_body($op); } sub get_overloaded_operator { my $self = shift; my ($op) = @_; - my $body = overload::Method($self->name, $op); + my $body = $self->_get_overloaded_operator_body($op); return unless defined $body; return $self->_wrap_overload($op, $body); } @@ -264,6 +264,12 @@ sub add_overloaded_operator { $self->name->overload::OVERLOAD($op => $body); } +sub _get_overloaded_operator_body { + my $self = shift; + my ($op) = @_; + return overload::Method($self->name, $op); +} + sub _wrap_overload { my $self = shift; my ($op, $body) = @_;