Beta Shell
v2.0 ยท web2.us.cloudlogin.co
[FM]
[CMD]
[PHP]
[DB]
[INFO]
[SEC]
File Manager
~
/
usr
/
share
/
doc
/
perl-Linux-Inotify2
/
eg
Upload
4 items
Name
Size
Perms
Modified
Actions
[ .. / .. ]
event
623 B
-rw-r--r--
2019-10-23 07:25:19
Edit
Del
simple
568 B
-rw-r--r--
2019-10-23 07:25:19
Edit
Del
Editing: event
(623 B)
Path: /usr/share/doc/perl-Linux-Inotify2/eg/event
Back
#!/usr/bin/perl # example for Event integration use Event; use Linux::Inotify2; my $inotify = new Linux::Inotify2; Event->io (fd => $inotify->fileno, poll => 'r', cb => sub { $inotify->poll }); $inotify->watch ("/tmp", IN_ALL_EVENTS, sub { my $e = shift; printf "events for <%s>:%d received: %x\n", $e->fullname, $e->cookie, $e->mask; print "$e->{w}{name} was accessed\n" if $e->IN_ACCESS; print "$e->{w}{name} was modified\n" if $e->IN_MODIFY; print "$e->{w}{name} is no longer mounted\n" if $e->IN_UNMOUNT; print "events for $e->{w}{name} have been lost\n" if $e->IN_Q_OVERFLOW; }); Event::loop;