NAME
AnyEvent::Filesys::Watcher::FSEvents - MacOS file system watcher
SYNOPSIS
$watcher = AnyEvent::Filesys::Watcher::FSEvents->new(
directories => ['lib', 't'],
callback => sub { warn "you're working too much"},
);
# This has the same effect as:
$watcher = AnyEvent::Filesys::Watcher->new(
backend => 'FSEvents',
directories => ['lib', 't'],
callback => sub { warn "you're working too much"},
);
DESCRIPTION
This is the Mac OS backend for AnyEvent::Filesys::Watcher. It uses Mac::FSEvents as the underlying implementation.
INSTALLATION
At the time of this writing, the version on CPAN is 0.14 and will most likely fail to build. It fails with "Could not parse version string!".
If you run into this problem, try to use the fork instead. See https://github.com/glohr/AnyEvent-Filesys-Watcher/#installation for more information.
CONSTRUCTOR
You should normally call the constructor of the base class that will pick the optimal backend for the current platform.
The following constructors are available:
- new(OPTIONS)
-
Creates a new AnyEvent::Filesys::Watcher. The constructor may throw an exception in case of an error!
OPTIONS is a hash of named options (all other options are passed verbatim to the constructor of Mac::FSEvents):
- directories DIRECTORIES
-
DIRECTORIES is a reference to an array of directories to monitor. A single directory can also be passed as a scalar.
Optional. The default is the base directory, see "base_dir" below.
- dirs DIRECTORIES
-
This is an alias for the option "directories".
- base_dir BASE_DIRECTORY
-
Relative path names for the "directories" option are resolved relative to BASE_DIRECTORY.
The default is the current working directory at the time that the object was instantiated.
- callback CALLBACK
-
A code reference that is called, when a modification to the monitored directories is deteced. The callback is passed a list of AnyEvent::Filesys::Watcher::Events.
One of the options "callback" or "raw_events" (see below) are required.
- cb CALLBACK
-
This is an alias for the parameter callback.
This argument is required if the argument callback has not been given.
- interval SECONDS
-
Specifies the latency for Mac::FSEvents. The latency is the time used by fsevents daemon to merge multiple events into fewer ones. A higher value may reduce the number of events triggered.
Optional. The default is 0.1 s.
- filter FILTER
-
FILTER should either be a regular expression or a code reference. If this is a regular expression, only (absolute) file names matching that regular expressions can cause an event.
If FILTER is a code reference, the subrouting receives the absolute file name as an argument and should return a truthy value for all files that should cause an event.
Optional. By default, all events are passed through.
All other options are ignored.
METHODS
See the base class AnyEvent::Filesys::Watcher. This module does not have any additional public methods.
ORIGINAL AUTHOR
Mark Grimes, <mgrimes@cpan.org>
CONTRIBUTORS
Gasol Wu <gasol.wu@gmail.com> who contributed the BSD support for IO::KQueue
Dave Hayes <dave@jetcafe.org>
Carsten Wolff <carsten@wolffcarsten.de>
Ettore Di Giacinto (@mudler)
Martin Barth (@ufobat)
AUTHOR
Guido Flohr <guido.flohr@cantanea.com>.
SEE ALSO
AnyEvent::Filesys::Watcher, Mac::FSEvents, perl(1)