You're misunderstanding what
can_read (or the analogous call to
select) means. They don't
exactly mean "which handles have waiting data"... they mean "for which handles will a read return imediately". So, for a file, a read will always return imediately, so a file will always return from
can_read. Even if you have read to the end of the file, reading from it again will just return you no data, but it will do so without
blocking.
Select is more about direct inter-process communication (like sockets and pipes), not inderect interprocess communication (by writing and reading from files).
I know you don't want to use it, but what you really seem to be talking about is the same sort of thing that File::FindTail does, which is to poll a file for changes in length every so often. To work that into what you're doing, just do your IO::Select call with a brief timeout (like 1 second or so), and check to see if the file has changed it's length in the interim. If so, seek to it's previous length, and read from there.
Update: added to the last paragraph a little so that it doesn't just say what is wrong but also says what you should do.
------------
:Wq
Not an editor command: Wq
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.