You should find a different way to read from plain files, for at least two reasons.

Multiplexing plain files is generally pointless because the operating system always reports them as "ready to read". That is, your select_read() event will fire immediately and constantly. You may as well do:

_start=>sub { $TXT = $poe_main_window->Scrolled('Text')->pack; $_[KERNEL]->yield('_GetInput'); }, _GetInput=>sub { if (defined(my $line = <$ifd>)) { print STDERR $line; $TXT->insert('end', "-$.- $line"); $poe_main_window->update; $_[KERNEL]->yield('_GetInput'); } },

Your example works on UNIX because that OS treats everything as a file. Sockets, plain files, pipes, terminals, etc. have their quirks, but deep down UNIX treats them equally.

As you're discovering, Windows isn't as nice. Even Perl's select() is limited to only working with sockets. This is why you can't get input notification for your plain file handle. The yield() based example above should be portable everywhere.

A third, bonus issue: You've been mixing unbuffered, multiplexed I/O with buffered reads. This is a classical problem that tends to end badly. For example, the file handle may report not-ready-to-read because the data you're looking for is in the input buffer. The yield() based example will avoid it.


In reply to Re^2: POE/Tk/Fileevent Strangeness by rcaputo
in thread POE/Tk/Fileevent Strangeness by cmv

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.