I'll try to answer these for UNIX/POSIX systems, since I don't know if they're universal:

If $fh is a pipe (stdin), then sysread will block and I will never try to seek on stdin, of which it is not capable

sysread will bock on pipes and sockets, unless you've specified unblocking behaviour. update: and you can't seek on pipes and sockets AFAIK, but seeking may flush system buffers.

If $fh is a file, the sysread will never block and at EOF the result will always be 0

AFAIK all reads block (i.e. wait for the data to arrive from disk, or network etc) unless you've got nonblocking behaviour. Reading on a file just won't block when you've reached EOF, similarly for closed pipes and sockets. I'm not sure if nonblocking behaviour does anything special on a file, but it might.

If $fh is a file, and the file gets renamed, the descriptor will not be affected and I will continue attempts to read from the same file

True.

If $fh is a file and it gets unlinked my open descriptor will maintain a reference to it, and I will not get an error - the file will simply stop growing, because no one will write to a non-existing file

True in a way, but if any other process already has that file open, they can still write to it, but if the file is completely unlinked (a file may have more than one entry point in the directory tree) you can't normally open() it (system specific tricks aside).


In reply to Re: Tailing a pipe or file by Joost
in thread Tailing a pipe or file by ribasushi

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.