tobold.org

correct • elegant • free

△ comp.lang.perl △

◅ Problems with PERL and Locking?

dbm error and weirdness ▻

[Q]: flocking file from read to write?

In article <ukenrlpisn.fsf@kelly.teleport.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>and you'll automatically make the *updated* file available
>*immediately* for someone else to flock.  Be sure to rename before you
>close the first one, though.

Umm... if you rename before closing, better make sure you've set
$|, else the file may be incomplete.

Personally, I use a separate (empty) lock file for most things
these days.  This means I can obtain the lock before I start changing
anything, and hold it till I've completely finished, so I don't
need to worry about subtle interactions like this.  They make my
head hurt, and an open's cheaper than an aspirin... :-)

Tim.
--
Tim Goodwin   | "MS-DOS is dwindling, only to be replaced by something
Cambridge, UK | even more bizarre and incomprehensible." -- Steve Summit

Original headers:

From: tim@pipex.net (Tim Goodwin)
Newsgroups: comp.lang.perl.misc
Subject: Re: [Q]: flocking file from read to write?
Date: 7 Mar 1996 16:04:16 GMT
Organization: Unipalm PIPEX
Lines: 19
Message-ID: <4hn1e0$m1a@wave.news.pipex.net>
References: <myk-2102962334230001@netcom.netcom.com>
  <ukenrlpisn.fsf@kelly.teleport.com>

△ comp.lang.perl △

◅ Problems with PERL and Locking?

dbm error and weirdness ▻