Re: calling $poe_kernel more than once

"Phil Whelan" <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
Hi Yuri,

Sounds like an interesting implementation of POE usage. I have no
experience of using POE runs within a larger application. I'll have to
try that out.

I haven't tested this myself, but you could try calling...

   POE::Kernel->get_active_session()

If there is no active session, then I guess POE would not be running.

Cheers,
Phil

On Sun, Mar 16, 2008 at 7:37 PM, Yuri Shtil <[email protected]> wrote:
> 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
>  >>  >
>  >>  >
>  >>
>  >>
>  >
>  >
>  >
>  >
>



-- 
Mobile: +1 778-233-4935
Website: http://philw.co.uk
Skype: philwhelan76
Email : [email protected]
iChat: [email protected]
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.