Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: File Locking in CGI programs

by tmoertel (Chaplain)
on Jul 06, 2005 at 04:19 UTC ( [id://472680]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://472680]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-25 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found