* Jiří Pavlovský <[email protected]> [2010-10-06T15:50:13]
> 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.

When are onStart and onEnd run?  before and after "run"?  If so, you want to
write a "run" method and then add

  before run => sub { ... };

  after run  => sub { ... };

-- 
rjbs

Reply via email to