|
|
| Don't ask to ask, just ask | |
| PerlMonks |
Using perl 6 roles in perl 5by clinton (Priest) |
| on Jan 18, 2006 at 11:49 UTC ( [id://523949] : perlquestion . print w/replies, xml ) | Need Help?? |
|
clinton has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking for the right OO approach to what I think amounts to perl 6 roles. I have an Object base class which is inherited by other objects eg User, Group, Image. When each of these is loaded, they register their Type with the Object class so that any object can be retrieved using the parent class and blessed into the right package.
An Object can never exist on its own - it must always be blessed into a child class. Group is a child class, and any object (including Groups) can be a member of a Group. Also, every object has a default Group (eg User automatically belongs to the group all_users). Requirements
Then in the package Group: Is this good, bad, ugly? Beauty, truth and love appreciated
thanks
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||