On Thu, Jan 29, 2004 at 04:33:27PM -0800, Tim Wood wrote:
>
>
> 1. Can one send events from one thread (that has not called
> POE::Kernel->run()) to a POE loop running in another thread? Let's say
> thread A uses POE, creates a POE::Session, saves $_[KERNEL] in a
> global, then calls POE::Kernel->run(). Thread B waits for the saved
> Kernel reference to appear (polling loop OK), and calls
> $savedKernelRef->post(...). Will this work? If not, what is the
> technique for messaging a POE loop from outside POE? Is that allowed?
You'll find in the documentation that you can access the kernel many ways.
There's POE::Kernel -> ..., there's also $poe_kernel, which you obtain
from 'use POE;'.
> 2. How do I get a reference to "self" inside an event handler? I found the
> following doesn't work:
> sub myEventHandler {
> my $self = shift;
> doSomething($_[ARG0]); # WRONG; ARG0 doesn't point to orig. 1st
> argument anymore
> ...
> Instead I've been saving a reference to the object that defines the session & event
> handlers in $_[HEAP]->{'myPOEObject'}. Is that the best way?
Reading this, I think you're really missing the point. Maybe if you asked
a question directly pertaining to "what you want to do", one of us could
give you a more appropriate answer.
Alex
--
[EMAIL PROTECTED]
Alex J. Avriette, Professional Something-or-Other
"Premature optimization is the root of all evil! BAD PROGRAMMER! No COOKIE!!!" -
Mark-Jason Dominus