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?

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?  

Thank you,
TW 

Reply via email to