Re: How to call post-constructor automatically

[email protected] (Yuval Kogman)
Newsgroups perl.moose
Message-ID <[email protected]>
On Thu, Oct 16, 2008 at 14:38:37 -0700, Yuri Shtil wrote:

> The trick is I want the method be called implicitly as a part of new.
> It is almost as having a hidden subclass of Two with a call to 
> post_constructor in its BUILD method.

I think this is exactly what you want,

	sub BUILD {
		shift->post_constructor;
	}

in Two will work as you expect.

That will be called even if a subclass adds another BUILD method,
but of course 'post_constructor' will be overridable normally (i'm
guessing that's why you don't want to just use BUILD?).

-- 
  Yuval Kogman <[email protected]>
http://nothingmuch.woobling.org  0xEBD27418
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.