Simple file locking schemehttp://search.cpan.org/perldoc?LockFile::Simple
This simple locking scheme is not based on any file locking system calls such
as flock() or lockf() but rather relies on basic file system primitives and
properties, such as the atomicity of the write() system call. It is not meant
to be exempt from all race conditions, especially over NFS. The algorithm used
is described below in the ALGORITHM section.
It is possible to customize the locking operations to attempt locking once
every 5 seconds for 30 times, or delete stale locks (files that are deemed too
ancient) before attempting the locking.