*BSD News Article 75910


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.sgi.com!enews.sgi.com!news.mathworks.com!newsfeed.internetmci.com!in3.uu.net!nntp.teleport.com!usenet
From: merlyn@stonehenge.com (Randal L. Schwartz)
Newsgroups: comp.lang.perl.misc,comp.unix.bsd.freebsd.misc
Subject: Re: 'vipw' Style File Locking in Perl
Date: 11 Aug 1996 07:30:10 -0700
Organization: Stonehenge Consulting Services; Portland, Oregon, USA
Lines: 37
Sender: merlyn@julie.teleport.com
Message-ID: <ukenlet2ml.fsf@julie.teleport.com>
References: <320DE5D9.3FF1@tassie.net.au>
NNTP-Posting-Host: julie.teleport.com
To: Brook@tassie.net.au
X-Newsreader: Gnus v5.2.39/Emacs 19.30
Xref: euryale.cc.adfa.oz.au comp.lang.perl.misc:36094 comp.unix.bsd.freebsd.misc:25303

>>>>> "Brook" == Brook Schofield <Brook@tassie.net.au> writes:

Brook> I am trying to write a change password script in perl that is accessed 
Brook> though a Web Browser, using Apache and FreeBSD 2.0.5.
[...]
Brook> I am having the problem with replacing the old with the new as
Brook> I need (or do I) to close the original file in order to open it
Brook> for re-writing.

Nope.

Brook>  I thought of an intermediate lock file, but not all programmes
Brook> on the system will use it.

Well, the sad thing is that you'll need to know *what* the other programs
use, and cooperate with them.  The only locking on Unix systems (that
I'm familiar with) is *advisory* locking, for *cooperating* processes.

But having said that, I'll point you in the direction of my
most-recently published WebTechniques column, which is specifically
about using flock() from a web-form to update a passwd(5)-like file.
Visit the URL:

	http://www.teleport.com/~merlyn/WebTechniques/

and read the disclaimers and restrictions (please!) and then select
col04 from the list.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $19,655.69 collected, $182,159.85 spent; just 751 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.teleport.com/~merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me