in reply to monitoring file changes (win32)

It seems there is no way on Windows to notify you that a file (handle) has been closed, as there might be multiple handles open to the same file. I guess the closest you'll get is Re: how to permanently monitor a directory, which will notify you of "no changes" after a certain amount of time has passed, in addition to other changes.

Replies are listed 'Best First'.
Re^2: monitoring file changes (win32)
by rgcosma (Beadle) on Sep 26, 2009 at 18:48 UTC
    Hello and thank you for the hint. The solution so far seems to be to thread the application, run $watcher->get_results() every 10 seconds, stat() each file and if the modification date is less than localtime()-10 ignore it. It should be picked by the next run. On to reading how threads work in Win32..
Re^2: monitoring file changes (win32)
by rgcosma (Beadle) on Sep 29, 2009 at 20:14 UTC
    After some more experimenting, I believe an apology is needed for the second point: all my tests were done in virtual machines - Virtualbox and Parallels. I have now tried the same using Microsoft's .Net System.IO.FilesystemWatcher and noticed the same problems. Something in the way those emulators handle filesystem changes causes events to not be triggered. My conclusion so far is that it's not a FS::W issue. POE::C::DW:O does work in the same setups though, this might be because it doesn't use Win32::ChangeNotify
    Any hints on where I should move this topic would be greatly appreciated.