in reply to How to wait for events, and not lose any, while processing them ?
One option is to use inotify with an event loop such as POE. Working example: Example code using Perl’s Linux::Inotify2 module with POE
Jason L. Froebe
Blog, Tech Blog