go ahead... be a heretic | |
PerlMonks |
Re: declaration order of attributes in Mooseby kyle (Abbot) |
on Apr 13, 2009 at 21:10 UTC ( [id://757279]=note: print w/replies, xml ) | Need Help?? |
Your hacky way of getting what you want doesn't work with the Moose I'm using (0.51). Here I can get a list of slots this way:
That gives the list in no particular order, however. Looking at the object with Data::Dumper, I don't see any place that stores an ordered list of attributes. I suspect that your "working" code is working by coincidence. Try it with this package:
I think the only way you're going to get what you want is to look into Moose's definition of has and patch it so that it tracks the information you want to have. You've asked us not to question your motives here, so I won't, but any code that requires this information probably has a design problem of some kind. I recommend finding another solution to whatever your real problem is.
In Section
Seekers of Perl Wisdom
|
|