in reply to Active Munging via a pipe (code)

Here's yet another way, demonstrated from the shell:

Make the pipe, and...

$ mkfifo logpipe $ perl -e 'open PIPE, "< logpipe"; { select 1<<fileno(PIPE),undef,unde +f,undef; print <PIPE>;redo}' &
... start a simple server in the background. select makes it sleep till PIPE is readable. redo in a bare block loops forever. Kick the tires:
$ echo foo >logpipe foo $ echo far >logpipe $ far echo fie >logpipe fie $
The asynchronous operation of the server is shown in the staggered output. Clean up with
$ fg perl -e 'open PIPE, "< logpipe"; {select 1<<fileno PIPE,undef,undef,un +def;print <PIPE>;redo}' # do a Ctrl-C here $
I think this is the Right Way® to handle your log file problem. Sleeping till there is something to read will save a lot of load on the host.

Update: Changed to use mkfifo instead of mknod, and repaired a pasto in the timeout arg of select.

After Compline,