Re: calling $poe_kernel more than once

2008-03-17 Thread Robert Landrum
Matt Cashner wrote: Second, in your magic POE wrapping api, you can use POE::API::Peek to determine the state of the kernel. I've got a is_running() method in there that you can either use via my module or rip out and use with credit. Yay for the bsd license :) Using the module would help me

Re: calling $poe_kernel more than once

2008-03-17 Thread Yuri Shtil
Your solution assumes only one object wrappping POE. Robert Landrum wrote: Matt Cashner wrote: Second, in your magic POE wrapping api, you can use POE::API::Peek to determine the state of the kernel. I've got a is_running() method in there that you can either use via my module or rip out and

Re: calling $poe_kernel more than once

2008-03-17 Thread Matt Cashner
On Monday, March 17, 2008, at 12:38PM, Yuri Shtil [EMAIL PROTECTED] wrote: Your solution assumes only one object wrappping POE. More importantly, it assumes that poe is only ever run once. It is very possible to run poe, complete whatever you want to do, shut poe down and for whatever reason

Re: calling $poe_kernel more than once

2008-03-16 Thread Yuri Shtil
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

Re: calling $poe_kernel more than once

2008-03-16 Thread Phil Whelan
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

Re: calling $poe_kernel more than once

2008-03-16 Thread Matt Cashner
I just took a brief diving trip through the source. Looks like that the various kernel bits check to see if $poe_kernel is live just to avoid setup costs. Even if there is a live kernel, it will attempt to launch into another core loop. I'm not sure a space-time continuum breach would

calling $poe_kernel more than once

2008-03-14 Thread Yuri Shtil
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

Re: calling $poe_kernel more than once

2008-03-14 Thread Matt Sickler
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] wrote: What will happen if $poe_kernel-run called more than once? If

Re: calling $poe_kernel more than once

2008-03-14 Thread Yuri Shtil
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]

Re: calling $poe_kernel more than once

2008-03-14 Thread Phil Whelan
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