Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^4: Object::InsideOut and Roles/Mixins

by Yary (Pilgrim)
on Apr 12, 2014 at 17:25 UTC ( #1082103=note: print w/replies, xml ) Need Help??

in reply to Re^3: Object::InsideOut and Roles/Mixins
in thread Object::InsideOut and Roles/Mixins

Thanks for that perspective. Here's another thought along those lines- at the minimum a role requires the composing class to implement some behavior (method). Maybe the role also has an implementation defined, which the class can just use. In that case, the role might want to have some data, or state, along with it, and then it's convenient for the role to also add an attribute- to support the method defined in that role.

And that's where you need to mesh with the larger framework. Or roll your own per-object attribute/state variable, but isn't it better to use what your framework already provides?

Then again, lack of attributes is not that big a deal. There's always package lexical hashes, or closures; also, getters and setters are just methods. And Role::Basic allows importing methods from some other class with that express purpose.


  • Comment on Re^4: Object::InsideOut and Roles/Mixins

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1082103]
[Discipulus]: good morning nuns and monks!
[FloydATC]: Is CPAN down?!?
[FloydATC]: I get a 404 for

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2018-01-24 08:07 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (256 votes). Check out past polls.