Perl has an internal psuedo-module called UNIVERSAL which all modules inherit from. It has a method called DOES , from the docs on UNIVERSAL .

$obj->DOES( ROLE ) CLASS->DOES( ROLE ) DOES checks if the object or class performs the role ROLE . A role is a named group of specific behavior (often methods of particular names and signatures), similar to a class, but not necessarily a complete class by itself. For example, logging or serialization may be roles. DOES and isa are similar, in that if either is true, you know that the object or class on which you call the method can perform specific behavior. However, DOES is different from isa in that it does not care how the invocand performs the operations, merely that it does. ( isa of course mandates an inheritance relationship. Other relationships include aggregation, delegation, and mocking.) There is a relationship between roles and classes, as each class implies the existence of a role of the same name. There is also a relationship between inheritance and roles, in that a subclass that inherits from an ancestor class implicitly performs any roles its parent performs. Thus you can use DOES in place of isa safely, as it will return true in all places where isa will return true (provided that any overridden DOES and isa methods behave appropriately).

I know Moose et al provide a DOES , and I understand how this is used. But in the sense of UNIVERSAL::DOES what is a ROLE ? How are they tracked? How are they created aside from Moose to satisfy DOES ? I tried looking in the source, but the implementation of DOES was not provided. Is this notion of a ROLE something in CORE perl? This seems to be related to the perldoc perlapi 's mention of sv_does_sv (also sv_does / sv_does_pv )

sv_does_sv Returns a boolean indicating whether the SV performs a specific, named role. The SV can be a Perl object or the name of a Perl class. bool sv_does_sv(SV* sv, SV* namesv, U32 flags)

I can see a call to sv_does_sv in the implementation of universal.c . What's the definition of a SV role? Where can I find more information about this?

From the user-level, what does the code here do, (this is a subref)

UNIVERSAL->can('DOES')