On Wed, May 22, 2002 at 05:22:55PM -0700, Peter Scott wrote:
> When I look at http://www.perl.com/2001/01/poe-math3.pl, it seems to me 
> that the child_done state is an orphan since I see no event hooked up to 
> it.  I can't get it to fire.
> 
> Yet it appears that it was intended to be called when the child connection 
> is broken.  Now, when the connection goes away the ErrorState is fired, 
> there just isn't a $! so it doesn't say anything.
> 
> I spent some time fruitlessly looking for an event that would be fired on 
> end of input to a RW wheel.  It seems a bit kludgy to test it by checking 
> in the ErrorState that the function is read() and the error is null.  Maybe 
> this is a dumb question, but why no such event?

Kludgey or not, read error 0 has always meant EOF.  Since there was a
standard way to do it, and because error checking is important anyway,
I didn't feel a pressing need to emit a CloseEvent from ReadWrite.

If there's call for it, Wheel::ReadWrite can check for read error 0
itself and emit a CloseEvent instead of an ErrorEvent.  It just moves
the check for $!==0 into the wheel.  If that happens, the other wheels
should probably follow suit.  I'm for interface consistency.

This might be a short, low-impact project for someone who wants
experience with the Wheel classes' guts.

However, if you're looking for a higher level interface to TCP
sockets, consider using POE::Component::Client:: or ::Server::TCP
instead.  Each has a "disconnect" callback that's distinct from its
"error" callback.

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net

Reply via email to