PERL does actually have a set of lockfile functions, but they didn't work
very well on my system (I honestly followed the instructions, but I couldn't
get it to lock reliably). Because of that, I ripped out the lockfile
functions from Agora (an email-to-web gateway).
You can download these functions as lockfile.txt and then rename it to lockfile.pl. You
add it to your PERL program with require "lockfile.pl" and use the
SetLockFile() function below.
$FN = SetLockFile("/directory", "filename") - Creates a lockfile in the
specified directory with "filename" as the lockfile's prefix. If there is a
lock file already, it will wait and try again. It returns the full filename
of the lock file. To remove the lock file, which you MUST do, call