On Monday, May 6, 2002, at 11:45 , Scot Robnett wrote:
> Is this on UNIX? Somebody on the list please correct me if I'm wrong, but > I don't believe flock will work on Windows, and I have no idea about Mac. I would presume that under OSX - since it has flock(2) - persuant to the perldoc -f flock that there's a reasonable chance that it should work... obviously it would be best to test. Rafael - you might want to generalize the function cf perldoc Fcntl use Fcntl ':flock'; # import LOCK_* constants sub WriteLog { my ($file, @input) = @_ ; open(OUTF,">>$file") or die"Couldn't open $file for writing: $!"); flock(OUTF,LOCK_EX); seek(OUTF,0,2); print OUTF "$_\n" for(@input); flock(MBOX,LOCK_UN); # always nice to unlock it close(OUTF); } since there is a higher chance that one will wander around with 'lines' of data best associated in a list.... but remember: " Advisory locks allow cooperating processes to perform consistent opera- tions on files, but do not guarantee consistency (i.e., processes may still access files without using advisory locks possibly resulting in inconsistencies). " cf man flock ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]