in reply to file lock and update
You probably want to use sysopen rather than open. The canonical way to do this (on a single output file) is something along the following lines:
There are a couple of very good discussions regarding file locking in the Camel (3rd Ed.). If you happen to have a copy, look in Chapters 16.2.1 and 23.2.2.use Fcntl qw(:DEFAULT :flock); sysopen(OUT, $outfile, O_WRONLY | O_CREAT) or die "Cannot open $outfile for writing:$!\n"; flock(OUT, LOCK_EX) or die "Cannot get a lock on $outfile:$!\n"; truncate(OUT, 0) or die "Cannot truncate $outfile:$!\n";
Otherwise, you can refer to the docs for sysopen and flock.
perldoc -q lock also gives some useful examples.
Hope this helps,
Darren :)
|
|---|