Tag Archives: constants

Perl – Lock Files (flock)

The following script is an example of using lock files in Perl. This prevents more than one user or process accessing a file at a time. use Fcntl qw(:DEFAULT :flock); use Fcntl ‘:flock’;¬†¬†¬†¬† #LOCK_* constants my($lockneedsremoving)=0; my($lockfilename)=”/var/.pwd.lock”; unless (createlock()) { … Continue reading

Posted in Perl | Tagged , , , , , , , , | Leave a comment