Let's say I want to model a house with 100 doors.
The Ruby code allows to call 100 times new() from class "Door" to create 100 door objects with independent states, because the methods of the mixins belong to the objects.
The shown Moose code OTOH needs 100 packages achieve this, cause all objects of such a package share the same roles. This doesn't sound very handy or scalable.
And I couldn't see any code to generate such classes, hence we have to manually name them Door1, Door2, ...Door100.
Plz correct me if I'm wrong.
Cheers Rolf
( addicted to the Perl Programming Language)
oops, I just realized that you already explained the mechanism behind apply_all_roles further up this thread. Sorry, I wasn't aware we are talking about the same approach.
In reply to Re^7: a State machine with Roles - possible? (class or instance)
by LanX
in thread a State machine with Roles - possible?
by mascip
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |