And right back at ya :)
- This problem came into existence while converting classical OO to Moose. The old code used dynamic multiple inheritance to try (but not succeed completely) to implement, what was later explained to me, the functionality of roles. Unfortunately, the way it was implemented meant that once features were added to an instance using multiple inheritance, all instances of that class got those features (instead of just the single instance).
- There are currently about 9 attributes in the Parent class, and an unspecified number in various child-classes. The fact that new child-classes (offering new roles) can be added with an arbitrary amount of (new) attributes (plus the fact that I can't be arsed to write 9 builder functions that return empty data :)) calls for the dynamic creation of builder functions (imho :P).
From the Moose's mouth:
http://search.cpan.org/~drolsky/Moose/lib/Moose/Manual/Construction.pod
The BUILD method is called after an object is created.
...
The interaction between multiple BUILD methods in an inheritance hierarchy is different from normal Perl methods. You should never call $self->SUPER::BUILD.
Moose arranges to have all of the BUILD methods in a hierarchy called when an object is constructed, from parents to children.
From which I concluded that first a parent object would be created and BUILD called, then the inheritance would kick in and the child's BUILD would be called.
Anyway, given the current situation, I'd need to dynamically figure out how $self relates to __PACKAGE__ and create the appropriate builder functions (if they don't exist already). Or something completely different.