Debian Codegraph @

eg/simple

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/opt/bin/perl
2
3 # very simple example without further modules
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