NAME
Mojo::File::ChangeNotify - turn file changes into Mojo events
SYNOPSIS
my $watcher =
Mojo::File::ChangeNotify->instantiate_watcher
( directories => [ '/my/path', '/my/other' ],
filter => qr/\.(?:pm|conf|yml)$/,
on_change => sub( $watcher, @event_lists ) {
...
},
);
# alternatively
$watcher->on( 'change' => sub( $watcher, @event_lists ) {
for my $l (@event_lists) {
for my $e ($l->@*) {
print "[$e->{type}] $e->{path}\n";
}
}
});
# note that the watcher might need about 1s to start up
IMPLEMENTATION
File::ChangeNotify only supports blocking waits or polling as an interface. This module creates a subprocess that blocks and communicates the changes to the main process.
SEE ALSO
File::ChangeNotify - the file watching implementation