As long as you document what you are doing so that the poor sap who has to
maintain your code after you win the lottery can figure it out, I say go
for it!  Wrapping _process_options is time honored, convenient, and an
absolute must technique for any mooser, imho.

As far as private methods:  _process_options is private, but could be
public.  clone_and_inherit_options is public, but really should be private.

On Thu, Dec 22, 2011 at 3:41 PM, Buddy Burden <barefootco...@gmail.com>wrote:

> Chris,
>
> > 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's a fair point.  My only counterpoint would be this bit of code:
>
> >     $class->_process_options($name, \%options) unless
> $options{__hack_no_process_options}; # used from clone()... YECHKKK FIXME
> ICKY YUCK GROSS
>
> which leads me to believe that, eventually, someone is going to change
> *something* about it. :-D
>
> > Well, that and I'm not sure how to accomplish any of this _without_
> poking
> > at the guts :)
>
> Well, both ealleniii and Todd provided alternatives which don't rely
> on any private methods, but yours has the advantage of being the
> absolute simplest (and least scary, really, private-method-meddling
> and all).  So I think I'm going to go with this approach for now.  If
> any other Moosites want to chiime in and tell me it's a terrible
> thing, I'll consider that if I do end up getting that wild hair and
> trying to wrestle it into a CPAN release.  But for now this works
> really well and doesn't hurt my brain too much. :-)
>
>
>             -- Buddy
>

Reply via email to