oakbox has asked for the wisdom of the Perl Monks concerning the following question:
Let's assume that the remote process is doing it's thing, and that I am now, sitting on my server, waiting for the result file.
When I get through that chunk, I know the file exists. Yeah! Now I need to wait for it to stop growing...my $sanity; while(1){ if(-e $pdffile){ last; } sleep 1; $sanity++; if($sanity > 60){ return(0); } }
Now for the question: Is this the *right* way to do this? Another programmer mentioned that using select/stat isn't reliable due to disk buffering/ network concerns.while(1){ select(undef, undef, undef, 0.5); # .5 second wait my $usizer = (stat($pdffile))[7]; # how big is that file? if($usizer eq $sizer){ last; } # did it grow at all? $sizer = $usizer; # set size for next round }
- Thank you,
Richard
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: select, stat, and waiting for files
by osunderdog (Deacon) on Sep 12, 2005 at 12:12 UTC | |
|
Re: select, stat, and waiting for files
by gri6507 (Deacon) on Sep 12, 2005 at 12:44 UTC | |
by gargle (Chaplain) on Sep 12, 2005 at 12:59 UTC | |
|
Re: select, stat, and waiting for files
by sasikumar (Monk) on Sep 12, 2005 at 13:23 UTC | |
by samizdat (Vicar) on Sep 12, 2005 at 14:12 UTC | |
by sgifford (Prior) on Sep 12, 2005 at 15:38 UTC | |
|
Re: select, stat, and waiting for files
by samizdat (Vicar) on Sep 12, 2005 at 13:00 UTC |