Hello everyone!

I have written a perl script which opens a file for reading and writing.
I tested what happens if the script is run in multiple instances by the
webserver.  I put a sleep command between seeking writing position in
the file and actual writing.  I filled the web form in two different
tabs of my browser and sent it. 

My impression was that the following happens:  
- first instance opens the file, 
- first instance seeks the writing position,
- first instance goes sleeping,
- second instance opens the same file,
- second instance seeks the writing position (different from the above
one),
- second instance goes sleeping,
- first instance wakes up,
- first instance writes the file,
- first instance closes the file,
- second instance wakes up,
- second instance writes the file,
- second instance closes the file.

After that procedure both changes has appeared in the file.

Does it mean, that on this system the multiple instance writing of a
file is handled well and I do not have to worry about locking the file
as long as the different instances write different positions in the
file?  Even the system administrator had the tip, that only the last
change will appear.

If I want to be sure that multiple instance writing will work, is append
a better choice?  I have read that on the archive of this list.

Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to