in reply to Reopen file when contents changed?
I'm not sure about things in /proc
Normally, if you stat the file and record dev/ino/ctime, and then read the data,
you can simply go into a sleep-1 loop until the stat of dev/ino/ctime changes.
For example:
my @base = stat($FILE); my $base = "@base[0,1,10]"; # dev/ino/ctime while (1) { ... read $FILE here, and process it ... while (1) { my @new = stat($FILE); my $new = "@new[0,1,10]"; # current dev/ino/ctime if ($base ne $new) { # changed $base = $new; # reset last; # restart outer loop } sleep 1; # delay because no change } }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In Section
Seekers of Perl Wisdom