Re: BUILD called twice.

[email protected] (Jesse Luehrs)
Newsgroups perl.moose
Message-ID <[email protected]>
On Thu, Feb 14, 2013 at 11:11:12AM -0800, Bill Moseley wrote:
> On Thu, Feb 14, 2013 at 11:00 AM, Jesse Luehrs <[email protected]> wrote:
> 
> >
> > In this case, you don't really want to be using BUILD at all, because
> > running everything is basically the entire point of BUILD. Maybe your
> > base class BUILD method should just call a separate init method, which
> > your subclasses can override?
> >
> 
> Yes, I agree.
> 
> What I'm trying to do is override the BUILD method in
> Catalyst::Model::DBIC::Schema  -- essentially to change one line.   So, the
> right thing to do with that is to move the code into an init() method,
> true.  But, I'm trying to override third-party code.
> 
> So, in a case where I cannot easily change the third-party base class, what
> about this ugly approach?:
> 
> 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(:

-doy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.