pr1@club-internet.fr (Philippe de Rochambeau) writes: }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? If, as it sounds here, the file is open read-only, why does it matter if several users are 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? I haven't verified this by looking in Inside Macintosh, but the way my Mac programs behave leads me to believe that only one Macintosh program at a time can hold any file open for writing. However, others can hold the same file open for reading at the same time, and I haven't tested to see what happens in MacPerl with open. Time to do some testing, I think. The open certainly wouldn't fail if you ask for read permission only. } }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. This is a topic that's discussed too often on comp.lang.perl.misc, with the tones of exasperation that leads me to think that the answer is in the Perl FAQ. The command is called "flock" (time for Shuck again), but using it properly is apparently a little tricky. If I were you, I'd track down the latest Perl FAQ (try <http://www.perl.com/> or maybe <http://www.perl.org/>). } }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 -------- Paul J. Schinder NASA Goddard Space Flight Center Code 693 Greenbelt, MD 20770 schinder@pjstoaster.pg.md.us ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch