in reply to Weirdness with IO::Select and IPC::Open3
Why did IO::Select brings GLOB(0x880fe78) up as ready for reading at all, when it was opened as the write (input) filehandle?
select actually signals when a file handle needs to be serviced. In addition to "ready to read" for can_read, that includes EOF and error conditions.
In this case, the OS is ready to communicate to you that you can't read from a write-only handle.
In general, you want two select objects, one for readers and one for writers. If you want to wait for either, you'd use select instead of can_*.
my ($r, $w) = IO::Select::select($readers_sel, $writers_sel, undef);
I don't understand why the program terminates after writing the answer to the first question.
You only call can_read once. You appear to be missing a loop.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Weirdness with IO::Select and IPC::Open3
by rastoboy (Monk) on Mar 22, 2011 at 01:41 UTC | |
by ikegami (Patriarch) on Mar 22, 2011 at 02:19 UTC | |
by rastoboy (Monk) on Mar 23, 2011 at 00:22 UTC |