What is really happening is that my code goes into the while loop and does not come out...even after an hour. What do you advice? Thanks.(Smacking hand on forehead...)
It would have helped for you to say that! OK, I see what's happening now. -M is not going to change in that loop for a file that's being "left alone", because the value is measured relative to the start of the program (as captured in $^T)!
Maybe what you want is more like this:
{ die unless my @stat = stat $the_file; my $seconds_until_one_hour_old = 3600 - (time - $stat[9]); last if $seconds_until_one_hour_old <= 0; # already old enough sleep $seconds_until_one_hour_old; # not yet redo; # and test again }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to •Re^3: file modified
by merlyn
in thread file modified
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |