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.


In reply to Re: Weirdness with IO::Select and IPC::Open3 by ikegami
in thread Weirdness with IO::Select and IPC::Open3 by rastoboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.