Searching for Mrs X
So yesterday I muddled myself up quite well, so It took a little time to see if I could come up with a solution. Thinking that someone else might have had the same problem I did a troll of Map of CPAN looking for a MooseX that might help me out.
Now I was looking at briefly at one point of using a delegated object but the problems with that is I contaminated my parent object with unneeded code and I would also have to iterate all the way though my attributes, never a good practice.
Now I did stumble upon MooseX::AttributeCloner and though there might be a solution. As always, I had a quick peek behind the scenes to see how it worked. Well as I suspected it only wraps all the iteration in a function, by calling 'meta->get_all_attributes' call. However, this is not really what I want, while it does allow me to quickly clone my DA instance for use in the LSD I still have the problem of all those Element and Field objects needing a role applied to them.
Now the next one I blundered into was MooseX::Interface and that made me laugh when it had
MooseX::Interface - Java-style interfaces for Moose
as the title, if you have been following these posts you would know why.
Main point of this one is stopping people who are extending your classes from implementing more than what you allow. I wanted this at one point but I am quickly coming to the conclusion that any DSL out there will need to implement all sorts of private functions and as long as the LSD is only ever a local sub instance I think I can do without this for now.
Next I had a look at MooseX::MultiObject which isn't what I need while it does allows me to enter many object at once I can do the same with ArrayRef[Object] and the next MooseX::MultiMethods is nice but really only gives me method signature not what I need.
Had a look at MooseX::Object::Pluggable which might help as I could load my LSD as plugins but really they are just roles by another name so for now I will put it in the maybe pile.
MooseX::RelatedClasses looks like something I could spend some time on. So it goes in the tryout pile as it allows me expand what my base DA classes have In a simple way. Will have to play quite allot to see if this is what I need.
MooseX::RelatedClassRoles is one that has really peeked my interest as it lets me use a role rather that a sub class to set up a dependency so another for the tryout pile
The next was MooseX::Scaffold and I think I will stay clear for now as I had a look at the test page and with an almost 50% test fail rate so I do not think it is stable enough to go into production code.
Finally I had a look as MooseX::ShortCut::BuildInstance now that would be useful from what I can see if I wanted to add in the View and Element objects into the DSLs rather than apply roles as I do now. I could use the present instance vars to create new ones in my DSL and even force them to have the roles I choose. Though a good deal of iteration and composition may be involved I will put this in the tryout pile
So it look like I have a little more work to do.
Leave a comment