HEX
Server: Apache/2.4.54 (Unix) OpenSSL/1.0.2k-fips
System: Linux f17.eelserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64
User: zulfiqar (1155)
PHP: 8.2.0
Disabled: mail, exec, system, popen, proc_open, shell_exec, passthru, show_source
Upload Files
File: //usr/share/doc/perl-Linux-Inotify2-1.22/eg/event
#!/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;