File locking in Perl is usually done using the the flock() manpage
function. Unfortunately, this only allows locks on whole files and is often
implemented in terms of the flock(2) manpage, which has some shortcomings.
Using this module file locking via the fcntl(2) manpage can be done
(obviously, this restricts the use of the module to systems that have a the
fcntl(2) manpage system call). Before a file (or parts of a file) can be
locked, an object simulating a flock structure must be created and its
properties set. Afterwards, by calling the 'lock()' method a lock can be
set or it can be determined if and which process currently holds the lock.
To create a new object representing a flock structure call 'new()':