|P is for Practical|
The necessity of flock-ing files that are only to be read.by Nemp (Pilgrim)
|on Sep 02, 2002 at 13:58 UTC||Need Help??|
Nemp has asked for the
wisdom of the Perl Monks concerning the following question:
I have a file on my webserver which needs to be read from to help produce some of the pages. I've been looking through the documentation for flock and some other previous posts here, such as here and the tutorial on file locking by turnstep, and I've come up with a few questions...
FYI: I'm not sure if this will change any answers or not but I have a sneaking suspicion it could; My host uses IIS on Windows2000 and I already know that flock() is supported.
First of all I read that appending to a file simultaneously without a lock just causes the data written to the file in an inter-mixed fashion. As I only plan to read the file - does this indicate I do not need to lock it? It is a static file and will theoretically not be changed ever. Should I use shared locks or are these rendered unnecessary by the fact I never plan to write or append to the file?