Filesys::Notify::Simple - Simple and dumb file system watcher
use Filesys::Notify::Simple; my $watcher = Filesys::Notify::Simple->new([ "." ]); $watcher->wait(sub { for my $event (@_) { $event->{path} # full path of the file updated } });
Filesys::Notify::Simple is a simple but unified interface to get notifications of changes to a given filesystem path. It utilizes inotify2 on Linux and fsevents on OS X if they're installed, with a fallback to the full directory scan if they're not available.
There are some limitations in this module. If you don't like it, use File::ChangeNotify.
There is no file name based filter. Do it in your own code.
You can not get types of events (created, updated, deleted).
Currently wait method blocks.
wait
In return, this module doesn't depend on any non-core modules. Platform specific optimizations with Linux::Inotify2 and Mac::FSEvents are truely optional.
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
File::ChangeNotify Mac::FSEvents Linux::Inotify2
To install Filesys::Notify::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Filesys::Notify::Simple
CPAN shell
perl -MCPAN -e shell install Filesys::Notify::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.