ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Linux-Inotify2/eg/simple
Revision: 1.1
Committed: Mon Aug 22 09:51:38 2005 UTC (21 years, 1 month ago) by root
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# Content
1 #!/opt/bin/perl
2
3 #r
4
5 use Linux::Inotify2;
6
7 my $inotify = new Linux::Inotify2;
8
9 $inotify->watch ("/etc/passwd", IN_ACCESS | IN_MODIFY, sub {
10 my $e = shift;
11 printf "events for <%s> received: %s\n", $e->fullname, $e->mask;
12 print "$e->{w}{name} was accessed\n" if $e->IN_ACCESS;
13 print "$e->{w}{name} was modified\n" if $e->IN_MODIFY;
14 print "$e->{w}{name} is no longer mounted\n" if $e->IN_UNMOUNT;
15 print "events for $e->{w}{name} have been lost\n" if $e->IN_Q_OVERFLOW;
16
17 $e->w->cancel;
18 });
19
20 $inotify->poll;
21