Dir-Flock --------- Directory-based advisory locking to provide synchronized access to some resource. Example: use Dir::Flock; # Existing directory my $dir = "/path/already/exists"; if (Dir::Flock::lock($dir)) { # synchronized code Dir::Flock::unlock($dir); } # Dedicated temp directory, flock semantics use Fcntl ':flock'; my $dir = Dir::Flock::getDir( "/some/path" ); # $dir is subdir of /some/path my $z = Dir::Flock::flock $dir, LOCK_EX | LOCK_NB; while (!$z) { print STDERR "Lock not available\n"; do_unsynchronized_things(); $z = Dir::Flock::flock $dir, LOCK_EX | LOCK_NB; } print STDERR "Acquired lock\n"; do_synchronized_things(); $z = Dir::Flock::flock $dir, LOCK_UN; # scoping semantics { my $mutex = Dir::Flock::lockobj( $somedir ); do_synchronized_things(); } # unlocked as $mutex goes out of scope # code block semantics Dir::Flock::sync { do_synchronized_things() } "/some/directory"; INSTALLATION To install this module, follow the usual recipe: perl Makefile.PL make make test make install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Dir::Flock You can also look for information at: AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/Dir-Flock CPAN Ratings http://cpanratings.perl.org/d/Dir-Flock LICENSE AND COPYRIGHT Copyright (C) 2019-2021 Marty O'Brien This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.