in reply to Most efficient File Modified check (w/o warnings)

If you're on Linux with a kernel >=2.6.13 you could use Linux::Inotify2 to ... err... notify you of the various changes in the file that you'd like to monitor. That's likely to be a lot more efficient than waking up and doing stat calls.


All dogma is stupid.

Replies are listed 'Best First'.
Re^2: Most efficient File Modified check (w/o warnings)
by Cefu (Beadle) on Nov 14, 2007 at 18:51 UTC

    Ahh... Linux. If only.

    For reasons I can't get in to I'm actually banging out this code on Windows right now while waiting for access to the UNIX box it will eventually run on. That is why I haven't bothered with the bits I'll need to deamonize it yet.

    There isn't, by any chance, something like Inotify2 for UNIX is there?

      There isn't, by any chance, something like Inotify2 for UNIX is there?

      Depends on your definition of UNIX :-)

      For the BSDs there's IO::Kqueue and Solaris has the FEM API, though no Perl wrappers for that is available on CPAN AFAICT, you might be able to do something with dtrace there.If you need something that works on UNIX/POSIX in general then your best bet is to go with stat, the other mechanisms are bound to be specific to the UNIX variant. Actually, I can even dimly remember reading something about Vista including a file event notification mechanism, but I haven't had to code for that OS in years so my interest in it is peripheral at best.


      All dogma is stupid.