-
-
19 Sep 2007 19:27:55 UTC
- Distribution: Linux-Inotify
- Module version: 0.05
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (2)
- Testers (270 / 253 / 211)
- Kwalitee
Bus factor: 0- 67.02% Coverage
- License: perl_5
- Perl: v5.6.1
- Activity
24 month- Tools
- Download (5.14KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Copyright 2005 by Torsten Werner. The code is licensed under the same license as perl: L<perlgpl> or L<perlartistic>.
- Dependencies
- Carp
- POSIX
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
Why not adopt me?
This distribution is up for adoption! If you're interested then please contact the PAUSE module admins via email.NAME
Linux::Inotify - Classes for supporting inotify in Linux Kernel >= 2.6.13
SYNOPSIS
Linux::Inotify supports the new inotify interface of Linux which is a replacement of dnotify. Beside the class Linux::Inotify there two helper classes -- Linux::Inotify::Watch and Linux::Inotify::Event.
DESCRIPTION
class Linux::Inotify
The following code
use Linux::Inotify; my $notifier = Linux::Inotify->new();
returns a new notifier.
my $watch = $notifier->add_watch('filename', Linux::Inotify::MASK);
adds a watch to filename (see below), where MASK is one of ACCESS, MODIFY, ATTRIB, CLOSE_WRITE, CLOSE_NOWRITE, OPEN, MOVED_FROM, MOVED_TO, CREATE, DELETE, DELETE_SELF, UNMOUNT, Q_OVERFLOW, IGNORED, ISDIR, ONESHOT, CLOSE, MOVE or ALL_EVENTS.
my @events = $notifier->read();
reads and decodes all available data and returns an array of Linux::Inotify::Event objects (see below).
$notifier->close();
destroys the notifier and closes the associated file descriptor.
class Linux::Inotify::Watch
The constructor new is usually not called directly but via the add_watch method of the notifier. An alternative contructor
my $watch_clone = $watch->clone('filename');
creates an new watch for filename but shares the same $notifier and MASK. This is indirectly used for recursing into subdirectories (see below). The destructor
$watch->remove()
destroys the watch safely. It does not matter if the kernel has already removed the watch itself, which may happen when the watched object has been deleted.
class Linux::Inotify::Event
The constructor is not called directly but through the read method of Linux::Inotify that returns an array of event objects. An Linux::Inotify::Event object has some interesting data members: mask, cookie and name. The method
$event->fullname();
returns the full name of the file or directory not only the name relative to the watch like the name member does contain.
$event->print();
prints the event to stdout in a human readable form.
my $new_watch = $event->add_watch();
creates a new watch for the file/directory of the event and shares the notifier and MASK of the original watch, that has generated the event. That is useful for recursing into subdirectories.
AUTHOR
Copyright 2005 by Torsten Werner <twerner@debian.org>. The code is licensed under the same license as perl: perlgpl or perlartistic.
Module Install Instructions
To install Linux::Inotify, copy and paste the appropriate command in to your terminal.
cpanm Linux::Inotify
perl -MCPAN -e shell install Linux::Inotify
For more information on module installation, please visit the detailed CPAN module installation guide.