[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] file-locking algorithm



I didn't know open a doc more than once.

In Unix.  Use Fcntl.pm which just Fcntl.h C header.  In C, you define fill
in the flock struct.  It perl you can just pack those data.

In C,
you have
struct flock{
	short l_type;
	short l_whence;
	long l_start;
	long l_len;
	pid_t pid;
}

In perl, All you do is pack a short, short, long, long and short which
passed to Fcntl. Check out the unix man pages on Fcntl. 

Robert Ke


On Thu, 5 Jun 1997, Philippe de Rochambeau wrote:

> I am currently designing a Perl program that lets people search through a
> text-file database using an HTML form. Can anyone suggest a simple
> file-locking algorithm to prevent several users on the Web from opening the
> file at the same time?
> 
> Question: does the Perl command "open" die whenever a file is being used by
> another acgi on the server machine?
> 
> Although I am designing and testing this Perl program on a Macintosh, I
> plan to eventually put it on an Unix server. As a result, the file-locking
> should also work on Unix, if possible.
> 
> Many thanks.
> 
> Philippe de Rochambeau
> 
> ______________________________________________________________________________
> Philippe de Rochambeau
> pr1@club-internet.fr
> 
> 
> 
> ***** Want to unsubscribe from this list?
> ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch
> 


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch