Ovid wrote:
> Moose:
>
> if ( $object->meta->does_role($some_role) ) { ... }
>
> Class::Trait:
>
> if ( $object->does($some_role) ) { ... }
>
> 5.10 ad hoc support?
>
> if ( $object->DOES($some_role) ) { ... }
>
> We have an internal Test::Most I've hacked to support this and it works for
> us because we only use Moose for roles, but I'd like to hear other ideas.
Get Moose and Class::Trait to fall in line with the 5.10 way of doing it.
# Moose
sub DOES {
return $_[0]->meta->does_role($_[1]);
}
# Class::Trait
sub DOES {
return $_[0]->does($_[1]);
}
--
On error resume stupid