tobold.org

correct • elegant • free

△ comp.lang.perl △

◅ Nee file lock example using fcntl

SIG{'INT'} ▻

How to open both for append and read?

In article <32ECDF02.41C6@mips.biochem.mpg.de>,
Dmitrij Frishman  <frishman@mips.biochem.mpg.de> wrote:
>I am using open(FH,$FileName) for read, open(FH,">$FileName") for
>write, and open(FH,">>$FileName") for append. But what if I want to
>lock my file, look up something, and then (maybe) append and unlock.

Use a separate lock file.  It's much simpler (and therefore more
likely to be correct) than trying to get your head round the possible
interactions.

Tim.
--
Tim Goodwin   | "A language needs both intestines and guts." -- Larry Wall

Original headers:

From: tim@pipex.net (Tim Goodwin)
Newsgroups: comp.lang.perl.misc
Subject: Re: How to open both for append and read?
Date: 28 Jan 1997 10:13:39 GMT
Organization: UUNET PIPEX
Message-ID: <5ckjgj$ki8@join.news.pipex.net>
References: <32ECDF02.41C6@mips.biochem.mpg.de>

△ comp.lang.perl △

◅ Nee file lock example using fcntl

SIG{'INT'} ▻