I used to always want a UNIX system call with semantics that said, "Block until a certain file exists." Now, you can poll for that, of course, but it's not near as fun (read "elegant") as having the OS (or at least something beyond your tiny little program) do it for you.
Today I discovered FAM, which is probably installed on your system. libfam provides just such a call. I gather that if you have a companion package, imon, installaed, imon will handle all monitoring for you, or else FAM will poll. Either way, you don't have to worry about it in your program. Plus, if several processes want to watch the same file, FAM doesn't duplicate effort.
FAM will handle several file events: creation, deletion, changes, etc. It is open source, from SGI. Works with GNU/Linux and IRIX, and rumored to work on FreeBSD and Solaris.
Re:And from Perl
jdavidb on 2002-10-02T19:54:26
Thanks! That was actually my next question, though I got distracted and never made it to CPAN to check.
Looks like this module is from 1997, so it probably hasn't been updated since you tried it. MMMV.
:) I was interested to notice that FAM was invented in 1989.