Maybe I'm reading your post in the wrong way, but you don't need anything more than reading from STDIN.
What I don't know is how to empty <STDIN> after that
Each read removes the data you read from STDIN, if you want to empty it just keep reading
and how long to wait before reading it again
You don't have to explicitly wait, if there's data your read will succeed, if there isn't your read will block gracefully until they arrive
I don't want to read <STDIN> when syslog is in the middle of sending the message
This is not a problem at all (I hope). Note that the idiom:
$line = <STDIN>
reads until end-of-file (which shouldn't happen in your case, unless you have major problems) or until it hits the end of the record separator $/, which is normally set to a newline to give you one line at a time.

So, if you analyse your logs on a line-oriented fashion, you don't have to do anything. OTOH, if you have to correlate different lines, you have to implement some logic to understand when and where you want to break your input into parts. Anyway, this doesn't seem a problem related to STDIN IMHO.

Hope this helps to fade away your fears.

Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

Don't fool yourself.

In reply to Re: Need to empty STDIN by polettix
in thread Need to empty STDIN by bofh_of_oz

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.