in reply to Re: Sleep and Perl
in thread Sleep and Perl
Hello toolic,
You may never get to the end of the file if you get more than 100 entries within 10 seconds. I believe the test needs to know the size of the file or the number of records to start with, otherwise you'll never know when you have xx records left.
If you know that each record average 100 bytes then...(untested)
I think this is similar to the 'pop before email' technique. YMMV.my $size = -s $file; my $avg_recsize = 100; while my $record ( <$in> ) { if ( ( $size - ( 100 * $avg_recsize ) ) <= 0 ) { sleep(10); $size = -s $file; } . . . }
Regards...Ed
"Well done is better than well said." - Benjamin Franklin
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Sleep and Perl
by derby (Abbot) on Dec 16, 2015 at 11:53 UTC | |
by SuicideJunkie (Vicar) on Dec 16, 2015 at 14:53 UTC | |
by flexvault (Monsignor) on Dec 16, 2015 at 18:36 UTC | |
by flexvault (Monsignor) on Dec 16, 2015 at 18:39 UTC |
In Section
Seekers of Perl Wisdom