On 7/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
snip
What's the most efficient way of checking this? - one way is perhaps
inifinite loop checking mmtime until it is stable for a certain amount
of time?? I am not sure.
snip
Yep, that is about it. I usually use size rather than mtime (mtime
checking can be broken by someone monkeying with the system time, it
happens). Something like
my @same;
until (@same == $seconds_the_same) {
my $size = (stat file)[7];
if ($same[0] == $size) {
push @same, $size;
} else {
@same = ($size);
}
sleep 1;
}
or
my $old;
my $same = 0;
until ($same == $seconds_the_same) {
my $size = (stat file)[7];
if ($old == $size) {
$same++;
} else {
($old, $same) = ($size, 0);
}
sleep 1;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/