Hi!

> Are there any real situations where roles are better than base classes?
> With examples, please.

I think MooseX::Storage is a nice example: You have some class (with 
whatever interitance tree), apply a generic role from CPAN, and bam! you 
can serialize your objects. Yes, you could achieve the same effect using 
plain old inheritance, but the you'd probably have to use multiple 
inheritance, which leads to all kinds of chaos (which of course can be 
managed, but why, when roles provide a cleaner solution).

https://metacpan.org/pod/MooseX::Storage

Greetings,
domm

-- 
#!/usr/bin/perl                              http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

Reply via email to