NAME
File::ChangeNotify::Event - Class for file change events
VERSION
version 0.31
SYNOPSIS
my $watcher = File::ChangeNotify->instantiate_watcher(
directories => [ '/my/path', '/my/other' ],
filter => qr/\.(?:pm|conf|yml)$/,
exclude => [ 't', 'root', qr(/(?!\.)[^/]+$) ],
);
for my $event ( $watcher->new_events ) {
print $event->path, ' - ', $event->type, "\n";
}
DESCRIPTION
This class provides information about a change to a specific file or directory.
METHODS
File::ChangeNotify::Event->new(...)
This method creates a new event. It accepts the following arguments:
path => $path
The full path to the file or directory that changed.
type => $type
The type of event. This must be one of "create", "modify", "delete", or "unknown".
$event->path
Returns the path of the changed file or directory.
$event->type
Returns the type of event.
$event->has_attributes
This returns true for modify events which include information about a path's attribute changes.
$event->attributes
If the event includes information about changes to a path's attributes, then this returns a two-element arrayref. Each element is in turn a hashref which will contain at least one of the following keys:
permissions
The permissions mask for the path.
uid
The user id that owns the path.
gid
The group id that owns the path.
Note that only keys which changed will be included.
$event->has_content
This returns true for modify events which include information about a file's content.
$event->content
This returns a two-element arrayref where the first element is the old content and the second is the new content.
Note that this content is stored as bytes, not UTF-8. You will need to explicitly call Encode::decode
on the content to make it UTF-8. This is done because there's no reason you couldn't use this feature with file's containing any sort of binary data.
SUPPORT
Bugs may be submitted at http://rt.cpan.org/Public/Dist/Display.html?Name=File-ChangeNotify or via email to bug-file-changenotify@rt.cpan.org.
I am also usually active on IRC as 'autarch' on irc://irc.perl.org
.
SOURCE
The source code repository for File-ChangeNotify can be found at https://github.com/houseabsolute/File-ChangeNotify.
AUTHOR
Dave Rolsky <autarch@urth.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2009 - 2019 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
The full text of the license can be found in the LICENSE file included with this distribution.