From: Yuval Kogman Date: Thu, 3 Jul 2008 17:55:00 +0000 (+0000) Subject: OPTIMIZE!!! YERHA!!!! X-Git-Tag: 0_55~55 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b837f8cf5e23bbeb80c223ae5f4fecf9829d077;p=gitmo%2FMoose.git OPTIMIZE!!! YERHA!!!! --- diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index feab57b..84b0c08 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -74,14 +74,13 @@ sub DESTROY { } # support for UNIVERSAL::DOES ... -sub DOES { - my ( $self, $class_or_role_name ) = @_; - if (my $DOES = __PACKAGE__->meta->find_next_method_by_name('DOES')) { - return $DOES->body->($self, $class_or_role_name) +BEGIN { + my $does = UNIVERSAL->can("DOES") ? "SUPER::DOES" : "isa"; + eval 'sub DOES { + my ( $self, $class_or_role_name ) = @_; + return $self->'.$does.'($class_or_role_name) || $self->does($class_or_role_name); - } - return $self->isa($class_or_role_name) - || $self->does($class_or_role_name); + }'; } # new does() methods will be created