tobold.org

correct • elegant • free

△ comp.lang.perl △

◅ Notorious problem with sockets and POP3 - please give me a clue

fcntl to lock a file? ▻

simultaneous dbmopen

In article <32F954EC.7327@creativeaccess.com.au>,
James Murray  <jaymez@creativeaccess.com.au> wrote:
>I've written a simple cgi perl script
>which uses a dbmopen call.
>
>Everything's fine, until it comes to a point where
>simultaneous calls are made to the same script.
>
>One processes opens the dbm file successfully, other processes can't
>accesses the file.

Sounds like dbmopen has decided to use GDBM_File.  The gdbm library only
permits one database writer at the same time, and the dbmopen interface
doesn't give you any way to say that you only want read access to the
database.

You should use tie, which gives you much better control.

    use GDBM_File;
    tie %hash, GDBM_File, $gdbm, GDBM_READER, undef or
            die "$0: can't tie to $gdbm: $!\n";

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: simultaneous dbmopen
Date: 7 Feb 1997 13:07:35 GMT
Organization: UUNET PIPEX
Message-ID: <5df9en$fnl@join.news.pipex.net>
References: <32F954EC.7327@creativeaccess.com.au>

△ comp.lang.perl △

◅ Notorious problem with sockets and POP3 - please give me a clue

fcntl to lock a file? ▻