On Tue, Apr 14, 2009 at 6:10 PM, Rolf Schaufelberger <[email protected]> wrote:
> How can I call some initialisation code in role applied to an already
> existing object ?
>
> Normally I use after 'BUILD' for this.
>
> When I call
>
> MyApp::Role::Job::Manager->meta->apply($lisa);
>
> the object lisa exists and so a Sub BUILD { ... }
>
> in MyApp::Role::Job::Manager doesn't be called.
> So where can I place my init stuff I need for my role ?
>
>
> Rolf Schaufelberger
MyApp::Role::Job::Manager;
...
after 'BUILD' => sub { shift->initalize_job_manager() }
sub _initalize_job_manager{ ... }
....
MyApp;
...
MyApp::role::Job::Manager->meta->apply($lisa)
$lisa->_inialize_job_manager();