No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I am not sure what you are asking here, are you looking for a trigger to be fired when C1 is reblessed into the anon-class?I did not think of that. I was supposing that whatever function wrapped the "pull in an extension" would apply a trait to C1, and then look up $instance->c2 and $instance->c3 and apply traits to them too. Basically, there are two approaches: (1) Create the extended class before creating the instance, and (2) Extend an existing instance. With (2), I can extend all the collaborators at the same time, using only logic within the function that loads and applies the extension. With (1), the extension of the top-level class needs to somehow change things so that when the collaborators are created, they are of the extended types too. Without a rebless hook, (2) needs to be wrapped by my code so I does all the steps; it can certainly call "lower level" Role->meta->apply as well. My original question was wondering if these had some syntactic sugar or more mature incarnations in another module already done (like Perl 6 "but" feature). But, I'm also supposing that I'm not breaking new ground in wanting an extension mechanism for a more complex case (not a single class, but functionality is broken up into smaller classes) and other people may have approached it already. As for my aversion to needless instance data, something I saw in MooseX::Traits raises another question. But I'll start a new post for that. Thanks for your patience. —John In reply to Re^4: Extensions via Moose
by John M. Dlugosz
|
|