On Fri, Feb 15, 2013 at 07:27:14AM -0800, Bill Moseley wrote:
> On Thu, Feb 14, 2013 at 11:34 AM, Bill Moseley <mose...@hank.org> wrote:
> 
> >
> >
> > On Thu, Feb 14, 2013 at 11:13 AM, Jesse Luehrs <d...@tozt.net> wrote:
> >
> >> > Baseclass->meta->remove_method( 'BUILD' );
> >>
> >> No, that's almost certainly a bad idea. I think the best option in this
> >> case is to take this question to #catalyst or #dbix-class, and see if
> >> they can come up with a better solution(:
> >>
> >
> > How bad? :)  Like bad break or bad ugly?   I think the only other solution
> > is to build my own version of Catalyst::Model::DBIC::Schema.
> >
> 
> Sorry to poke on this, but in a meeting yesterday afternoon discussing
> solutions other developers asked this same question.
> 
> Mostly wondering if it can potentially break Moose or it was simply that
> brute-force removal of a parent's method is simply a bad idea in general --
> especially one that the parent's author might have assumed would always
> run.   It would be great if I could give them a more "official" answer.
> 
> In the end we replaced Catalyst::Model::DBIC::Schema with our own modified
> version.  But, that's about as brute-force replacement of the parent's
> BUILD method as you can get. :)   But, there could be cases where one would
> not want to do something so global, yet need to override or somehow modify
> the BUILD method as one might normally do for other methods via a subclass.

It could easily break things because first of all, it's a global change,
which could break other code that isn't expecting it, and second of all,
there's no way to guarantee that your code will continue to do the right
thing, since a new release could easily add additional functionality
into BUILD which your overridden version would no longer do (and this
sort of thing would be quite difficult to track down). Can you perhaps
override compose_namespace in your schema classes instead? Otherwise,
again, I highly recommend you ask the Catalyst or DBIC communities for
help in doing what you want, since they are much more likely to have
useful solutions.

-doy

Reply via email to