Wrapping _process_options is cool. I complained about it on irc a few months ago, and was informed that I was over thinking, and for moose it is ok.
About a million MooseX modules use this technique. On Thu, Dec 22, 2011 at 3:27 PM, Chris Weyl <cw...@alumni.drew.edu> wrote: > On Thu, Dec 22, 2011 at 3:00 PM, Buddy Burden <barefootco...@gmail.com> > wrote: >> >> No, you've hit it straight on the head, and I agree it's minimally >> invasive, but the downside is that I'd be wrapping a private method, >> which strikes me as dangerous. What if that chunk of Moose guts >> changes out from under me? > > > I've always had the opinion that if I'm writing metaclass traits, then by > definition I'm changing the private parts to accomplish my task. Which to > me makes it far more acceptable than, say, poking at _process_options() from > outside of Moose::Meta::Attribute. That is, I'm not accessing private > methods inappropriately, as once the trait is consumed it's part of the > class itself. (/me braces for contrary commentary) > > Well, that and I'm not sure how to accomplish any of this _without_ poking > at the guts :) > > I'm not in a position to guarantee anything, but _process_options() has been > around for as long as I can remember. IMHO it's pretty safe to rely on this > method being there for the foreseeable future. > >> BTW, in the odd coincidence department, your AutoDestruct attribute >> trait was one of the ones I was cribbing off of when I wrote my >> original attempt (the other being Karen Etheridge's >> SlurpyConstructor). So thanks for that inadvertent bit of inspiration >> as well. :-) > > > No problem! I'm glad it helped :) > > -Chris > > -- > Chris Weyl > Ex astris scientia