I tried writing a test script to see if I can reproduce the issue, but unfortunately the script works fine either way.

This is the value of an SSCCE - it shows that there is something else amiss in your production script which is causing the problems. Your next task is to identify what else it might be in the production script and to incorporate that into your test script. Keep doing that until you can reproduce the problem.

Interestingly, when I put a print statement (marked HERE) in my script, the can_read() seems to work.

Given your use of IO::Select it could well be that you've done something unexpected with STDOUT and the currently selected handle in the code you have not shown us. Perhaps that is worthy of your attention?

Note that in your original post you have used the phrase "the script" and "my script" to refer to both your production script and your test script at various places. This just adds to the confusion. Try to be as specific and unambiguous as possible.


🦛


In reply to Re: IO::Select woes by hippo
in thread IO::Select woes by Anonymous Monk

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.