Subject: | Docs suggestion for POE::Wheel::Read |
Date: | Tue, 2 May 2006 22:23:15 -0400 |
To: | poe [...] perl.org |
From: | Jordan Coleman <jordan [...] JordanColeman.com> |
Hey, I just spent a couple of hours tracking down a bug in my code
before I figured out what was wrong and I wanted to suggest a change
to the docs that might prevent someone else for suffering through the
same pain.
My problem turned out to be that POE::Wheel::Read was emitting the
ErrorEvent event but was not setting the ARGs in a way consistent
with the docs. It wasn't until I stumbled on some sample code in the
cookbook that I realized that ErrorEvent can be triggered with ARG0
set to 'read', ARG1 (errno) set to 0, and ARG2 (string value from $!)
blank when reporting a closed filehandle. This isn't mentioned in
the docs, which suggest the following sample event handler which
clearly would produce an unhelpful message in this (probably common)
situation:
sub error_state {
my ($operation, $errnum, $errstr, $wheel_id) = @_[ARG0..ARG3];
warn "Wheel $wheel_id generated $operation error $errnum:
$errstr\n";
}
Anyway, just wanted to suggest that the POD in POE::Wheel::Read be
amended to explain this behavior and, if it doesn't break something,
that some code be added to provide a meaningful message in ARG3 when
ARG2 is set to 0.
++Jordan