in reply to Moose: How to check if a class implements a role?
There's $obj->does("MyRole") supported by Role::Tiny, Moo::Role, Mouse::Role, Moose::Role and Stevan Little's current prototype for a core Perl 5 mop, but I'd personally recommend using $obj->DOES("MyRole") (which is also supported by all of the above frameworks) because that's defined in UNIVERSAL, the base class for all Perl classes, and thus you're pretty much guaranteed to not get a Can't locate object method "does" via package "Foobar" error message (unless the class has gone seriously out of its way to prevent you calling DOES).
|
|---|