in reply to Linux::Inotify2 remove single watch

Linux::Inotify2 is a very thin wrapper for the inotify system calls. The poll returns with zero events because inotify_rm_watch causes an event on the watch descriptor (but this event is discarded).

Perhaps a modification to loop logic can fix your problem:

$inotify->poll while !$done;

Replies are listed 'Best First'.
Re^2: Linux::Inotify2 remove single watch
by agarrubio (Novice) on Jul 30, 2016 at 20:29 UTC
    Many thanks! That worked. So if I want the loop forever (it is in a daemon), it would be :
    $inotify->poll while 1
    Right?
      This is correct - the Linux::Inotify2 documentation was consistently wrong, read and poll both croak on errors. This has been fixed in release 2.0.