On Wed, Oct 06, 2010 at 09:50:13PM +0200, Jiří Pavlovský wrote:
> Hello,
>
> is there some established opinion/best practice on how to provide some
> sort of startup/shutdown hooks to your Moose class?
> What I basically want is something like:
>
> package MyClass;
> use TheGreatClass;
>
> sub onStart {
> }
>
> sub onEnd {
> ]
>
> in application:
>
> use MyClass;
>
> MyClass->new->run;
>
>
> Something akin to what Test::Class does, but possibly without the sub
> attributes.
I don't know what Test::Class does, but if you want something that runs
when an instance is created or destroyed, you want BUILD and DEMOLISH -
see Moose::Manual::Construction.
-doy