On Sun, Jun 01, 2003 at 09:35:56AM -0700 Bob's Demise wrote:

> I've written a Perl/CGI that allows a user to search
> for a string in a specified file.  I've yet to make
> this little program widely available - and currently
> with one or two users - it's quite speedy.  I
> anticipate no more than 20 users attempting to access 
> the same file at the same time - and this probably
> won't occur very often.  I intend to eventually move
> this data to database and use DBI.  Until then - I'm a
> bit concerned.  Any undesirable results I might
> expect?
>  Is it necessary to lock a file for reading?  My gut
> suggests the file won't be available until the file
> handle closes or the program ends. 

You need locking when you have several process indeterministically
reading and writing to this file. In your case, there is only reading
involved so you don't need need any locking at all.

However, it wont hurt to place a shared lock on the file (LOCK_SH from
the Fcntl module). That way you can later easily extend the script if
the need for writing to the file should arise.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to