Neither supports run-time role composition, as-in:
http://dev.perl.org/perl6/doc/design/syn/S12.html#Roles
The does operator returns the object so you can nest mixins:
$fido does Sentry does Tricks does TailChasing does Scratch;
Unlike the compile-time role composition, each of these layers on a new
mixin with a new level of inheritance, creating a new anonymous class
for dear old Fido, so that a .chase method from TailChasing hides a
.chase method from Sentry.
To help with DBI v2 I need a Perl5 implementation of roles that supports
run-time role composition.
I figure it just needs to generate a new class with @ISA set to
ref($random_object), link-in the methods, then rebless $random_object into it.
Plus a cache to avoid setting up a new class if it's already generated
one for ref($random_object)+$role_name.
I'd work on it myself but I'm busier than usual at the moment[1] and I
don't know which of Class::Role or Class::Roles I should add it to.
If no one volunteers I'll have a go in a week or three.
Tim.
[1] Our second child will be arriving 'any day'.