On Thu, Jan 29, 2004 at 04:33:27PM -0800, Tim Wood wrote:
>
Your message has been altered. It has been formatted to fit the screen.
>
> 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?
1. I don't know. Nobody has investigated this line of development, or
at least they haven't lived to tell us about it.
I suggest you try it. Write a small test case, and post it with your
results. Perhaps it can be worked out. Or maybe it will help outline
the issues in its way.
2. If you're using object_states: my $self = $_[OBJECT];
--
Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/