HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/doc/liblinux-inotify2-perl/examples/simple
#!/usr/bin/perl

# very simple example without further modules

use Linux::Inotify2;

my $inotify = new Linux::Inotify2;

$inotify->watch ("/etc/passwd", IN_ACCESS | IN_MODIFY, sub {
   my $e = shift;
   printf "events for <%s> received: %s\n", $e->fullname, $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;

   $e->w->cancel;
});

$inotify->poll;