in reply to Yet another Open3 issue . . . or is it?

the sysread always returns 0 bytes, with no warnings or errors.

But you're not checking for errors.

my $bytes = sysread($handle,$buf,1024); if ($bytes == 0) {
should be
my $bytes = sysread($handle,$buf,1024); die "sysread: $!" if !defined($bytes); if ($bytes == 0) {

You imply you have warnings turned on, in which case this won't help since you'd get "Use of uninitialized value in numeric eq (==)" on error.

Replies are listed 'Best First'.
Re^2: Yet another Open3 issue . . . or is it?
by Anonymous Monk on Jul 15, 2010 at 18:42 UTC

    Thanks for your reply, ikegami.

    The code I posted is really an "overview" of what appears in several modules, and in fact we are checking for errors as you described:

    if (not defined $bytes) { warn . . . $sel->remove($handle); next; }
    At this point I'd love to get an error or warning, but unfortunately it simply returns 0 bytes as if the handle were empty.