Hi. On 8 November 2010 15:46, Chap Harrison <c...@pobox.com> wrote: > > On Nov 7, 2010, at 6:47 PM, shawn wilson wrote: > >> its Unix, I'd use cron as its probably already running. And do something >> like: script.pl $(find <path> -type f -print0) Every few seconds. > > That looks plenty straightforward enough, except how does one prevent a race > condition wherein cron launches another instance of script.pl before the > first instance has exclusively grabbed responsibility for loading the > newly-arrived files?
Using a temporary file might be one approach. i.e., in your code, you write one when processing, exit if it exists in other subsequent code. This way no code can gobble up each other's resources even though polling isn't the coolest thing on earth - it does the job. If you want to tackle it another way, check out dnotify/inotify syscalls. HTH. [...] -- Regards Ishwor Gurung Key id:0xa98db35e Key fingerprint:FBEF 0D69 6DE1 C72B A5A8 35FE 5A9B F3BB 4E5E 17B5 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/