bofh_of_oz has asked for the wisdom of the Perl Monks concerning the following question:
I am writing a script to process syslog messages passed to it. Syslog-ng takes care of filtering the messages so that only the valid ones will be sent to the program/script. The problem is, syslog will start the script only once, and will send messages to the <STDIN> of the script as they arrive.
What I need is to read <STDIN>, clear it (make it empty), and check it again later.
I know I can read <STDIN> with $line = <STDIN>; What I don't know is how to empty <STDIN> after that and how long to wait before reading it again (I don't want to read <STDIN> when syslog is in the middle of sending the message)
Any advice/pointers are appreciated.
--------------------------------
An idea is not responsible for the people who believe in it...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need to empty STDIN
by 5mi11er (Deacon) on May 20, 2005 at 15:40 UTC | |
|
Re: Need to empty STDIN
by zentara (Cardinal) on May 20, 2005 at 15:42 UTC | |
by bofh_of_oz (Hermit) on May 20, 2005 at 16:11 UTC | |
by zentara (Cardinal) on May 20, 2005 at 18:47 UTC | |
|
Re: Need to empty STDIN
by polettix (Vicar) on May 20, 2005 at 17:07 UTC | |
by bofh_of_oz (Hermit) on May 20, 2005 at 18:11 UTC |