XP is just a number | |
PerlMonks |
Re: File Locking in CGI programsby tmoertel (Chaplain) |
on Jul 06, 2005 at 04:19 UTC ( [id://472680]=note: print w/replies, xml ) | Need Help?? |
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 Moertel : Blog / Talks / CPAN / LectroTest / PXSL / Coffee / Movie Rating Decoder
In Section
Seekers of Perl Wisdom
|
|