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

NAME

MYDan::Util::ProcLock - Advisory lock using a regular file

SYNOPSIS

 use MYDan::Util::ProcLock;

 my $lock = MYDan::Util::ProcLock->new( '/lock/file' );

 if ( my $pid = $lock->check() )
 {
     print "Locked by $pid.\n";
 }

 $lock->lock();
 

METHODS

check()

Returns PID of owner, undef if not locked.

lock()

Attempts to acquire lock. Returns pid if successful, undef otherwise.

read()

Returns a running pid or undef.