File::Lock::Simple 0.1 Copyright (c) 1998, Raphael Manfredi ------------------------------------------------------------------------ This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, a copy of which can be found with perl. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Artistic License for more details. ------------------------------------------------------------------------ *** This is alpha software -- use at your own risks *** SYNOPSIS use File::Lock::Simple qw(lock unlock); lock('file') || die "Can't lock file\n"; open(FILE, '>>file') || die "Can't append to file: $!\n"; .... close FILE; unlock('file'); DESCRIPTION The File::Lock::Simple extension provides simple file locking, of the advisory kind, i.e. it requires cooperation between applications wishing to lock the same files. It is meant to be used in quick-and-dirty scripts or more elaborated programs that want a simple locking scheme, yet with a reasonable level of configuration. This code comes from the mailagent-3.0 package and retains most of its configuration abilities. I do not intend to leave this simple scheme as-is forever. The code is designed to be extended to offer other locking schemes, such as MTA locking--usually a combination of this simple scheme and flock(). Despite being flagged as simple and not bullet proof all over the place, locking is good enough for simple applications wishing to protect against concurrent actions. There is an embeded POD manual page in Simple.pm. Raphael Manfredi