FlockDir - override perl flock()
for network or portability purposes
use File::FlockDir qw (open close flock);
open (FH, ``>$path'');
flock(FH, 2);
close FH;
A flock module for Windows9x and other systems lacking
a good perl flock()
function (not platform specific)
Usage:
use File::FlockDir qw (open close flock);
OR (careful)
use File::FlockDir qw (GLOBAL_open GLOBAL_close GLOBAL_flock);
Rationale: flock on Win95/98 is badly broken but
perl code needs to be portable. One way to do
this is to override perl's open(), flock(), and close().
We then get an absolute file specification for all opened
files and and use it in a hash to create a unique lock for
the file using the File::LockDir module from Perl Cookbook,
by Christiansen and Torkington (O'Reilly, 1998). This module may
be included in the CPAN distribution but belongs to those authors.
New code is deliberately kept at a minimum. As with nflock(),
this will allow flock()
to work over a network (usually).
flock()
that file over the network.
Perl Cookbook, by Tom Christiansen and Nathan Torkington.
This module is an extension of Perl Cookbook's nflock(), in chapter 7, section 21 (7.21, pp 264-266).
William Herrera <wherrera@lynxview.com>