Re: calling $poe_kernel more than once
Yuri Shtil <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
Hi Phil, I have sketched an object module that hides the POE under the hood. The user "loads" the object and then calls the method run (!surprise!). The run method in turn calls $poe_kernel->run. The problem may arise when the user creates more similar objects in callbacks/event handlers and calls the run on them. The whole idea was to make the user of the objects POE ignorant. In any case, if calling $poe_kernel->run from the POE loop may destroy the universe, the question is: how to detect that the POE loop is active? Phil Whelan wrote: > Hi Yuri, > > >> > What will happen if $poe_kernel->run called more than once? >> > > >> What if it is called while in the POE loop? >> > > I think it may tear a hole in the space-time continuum! > > I'd be interested to see how you've structured your code to get this > to be called twice. I usually just do the following... > > <set up sessions to run here> > > POE::Kernel->run; > exit; > > Cheers, > Phil > > On Fri, Mar 14, 2008 at 4:49 PM, Yuri Shtil <[email protected]> wrote: > >> What if it is called while in the POE loop? >> >> >> Matt Sickler wrote: >> > Go right ahead. run() doesn't return until the POE loop completely >> > shutsdown, so its somewhat pointless. >> > IIRC, the wiki has an example where it does make sense. >> > >> > On Fri, Mar 14, 2008 at 3:54 PM, Yuri Shtil <[email protected] >> >> >> >>> <mailto:[email protected]>> wrote: >>> >> > >> > What will happen if $poe_kernel->run called more than once? >> > >> > If this is bad, is there a way to detect that the loop is already >> > active. >> > >> > -- Yuri >> > >> > >> >> > > > >