On Thu, Jun 18, 2009 at 05:37, Raymond Wan<r....@aist.go.jp> wrote: > > Hi Ajay, > > Ajay Kumar wrote: >> >> Hi all >> I have one requirement that >> Suppose I have one file sample.txt >> >> I just want one mail if anybody touch this file >> Can you guys suggest me how I can implement this ? > > > In addition to Steve's code, if you are using a Linux/Unix system, you can > make his script run as a cronjob. I think there is something similar in > Windows, but I'm not too sure. This is, of course assuming the system > allows you to have cronjobs (some systems are configured so that users are > not allowed to create them). > > Ray > > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > >
If you are on a Linux/UNIX system I would not suggest using a polling method at all. Most UNIXes now provide a kernel level notification system that you can register with to tell you if a file has been accessed. In Linux it is called [inotify][1], and there is a Perl module that allows you to use it: [Linux::Inotify][2]. [1] : http://en.wikipedia.org/wiki/Inotify [2] : http://search.cpan.org/dist/Linux-Inotify/lib/Linux/Inotify.pm -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/