The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Proc::tored::LockFile - Guard actions with atomic writes

VERSION

version 0.20

SYNOPSIS

  use Proc::tored::LockFile;

  my $lockfile = Proc::tored::LockFile->new(file_path => '/path/to/something.lock');

  if (my $lock = $lockfile->lock) {
    ...
  }

ATTRIBUTES

file_path

Path where lock file should be created.

METHODS

lock

Attempts to lock the guarded resource by created a new file at "file_path". If the file could not be created because it already exists (using O_CREAT|O_EXCL), the lock attempt fails and undef is returned. If the lock is successfully acquired, a Guard object is returned that will unlink the lock file as it falls out of scope.

AUTHOR

Jeff Ober <sysread@fastmail.fm>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Jeff Ober.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.