Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/doc/perl-Linux-Inotify2/eg/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-Linux-Inotify2/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;


Hry