Re: Run code on object creation after new() and bless?

[email protected] (Sartak)
Newsgroups perl.moose
Message-ID <[email protected]>
On 4/3/08, Tod Hagan <[email protected]> wrote:
> Hi all,
>
> [...]
>
>  Is there a way to run code following object creation and the blessing of
>  the object? Or should I give up trying to hide the extra method call and
>  require calling a method following the creation of the object?

Hi Tod,

Define a BUILD method for your class, and that will be called with the
blessed object, before new returns it.

>  Thanks.
>
>  Tod

Shawn
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.