Astonishingly enough, I have a module which needs to distinguish between sysread() and read() for a tied filehandle. This arises because the semantics for sysread() (block until a packet of data arrives on a socket) and read() (block until the desired length of data arrives) are slightly different, which complicates life immeasurably for those expecting the wrong behavior.

To make a long story short, printing a stack trace from the READ() method in the tied filehandle class does not allow one to tell whether the programmer did read(FOO...) or sysread(FOO...). I also can't use any hackish solutions like inserting a wrapper for sysread() in the programmer's namespace...this has to be a respectable module. Are there any clever solutions to this problem, or should I just request that a SYSREAD() method be added for tied filehandles in Perl 5.10?

In reply to Distinguishing sysread() and read() in tied handles by behroozi

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.