in reply to File Locking in CGI programs

If your software runs on Linux, you do not need the locking code, nor the seeking code. Just open the file in append mode and commit each log entry as a single write. Unix file semantics guarantee that the write will append to the file atomically. (For more information see Re^3: Looking for a simple multiprocess-enabled logging module, in which I explain more and invoke the Single Unix Specification.)

See also "All I want to do is append a small amount of text to the end of a file. Do I still have to use locking?" from perlfaq5.

Cheers,
Tom