Bob'S Demise wrote: > Hello > > 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.
Your file needs to locked against writing but that's all. You can achieve this operationally (by only changing a maintenance copy while your site is live). If your file is large you may want to speed up access by writing a form of index to your file. Something as basic as a dumped hash of relevant key fields would help. Data::Dumper for output and 'eval' for input. It depends a lot on what your data look like though. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]