File::ChangeNotify::Event - Class for file change events
version 0.31
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"; }
This class provides information about a change to a specific file or directory.
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".
Returns the path of the changed file or directory.
Returns the type of event.
This returns true for modify events which include information about a path's attribute changes.
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.
This returns true for modify events which include information about a file's 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.
Encode::decode
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.
irc://irc.perl.org
The source code repository for File-ChangeNotify can be found at https://github.com/houseabsolute/File-ChangeNotify.
Dave Rolsky <autarch@urth.org>
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.
To install File::ChangeNotify, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::ChangeNotify
CPAN shell
perl -MCPAN -e shell install File::ChangeNotify
For more information on module installation, please visit the detailed CPAN module installation guide.