Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 19054
Status: resolved
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: jordan [...] JordanColeman.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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
Subject: POE::Wheel::Run, not POE::Wheel::Read
From: jordan [...] JordanColeman.com
This bug report should be for "POE::Wheel::Run", not "POE::Wheel::Read". My overtired fingers typed it wrong. Like three times.
Hi. Thanks for the suggestion. To be honest, I didn't think it necessary to explain that "$!" eq "" for $! == 0, because that behavior is part of Perl and not specific to POE. Nevertheless, I've updated POE::Wheel::Run's POD to read: C<ARG1> and C<ARG2> hold numeric and string values for C<$!>, respectively. C<"$!"> will eq C<""> for read error 0 (child process closed STDOUT or STDERR). ... and ... sub error_state { my ($operation, $errnum, $errstr, $wheel_id) = @_[ARG0..ARG3]; $errstr = "remote end closed" if $operation eq "read" and !$errnum; warn "Wheel $wheel_id generated $operation error $errnum: $errstr\n"; } The previous code snippet is indented in the documentation. It may not appear so because rt.cpan.org tends to clobber leading whitespace.