Proc::Lock - lock interface module
use Proc::Lock; my $lock = new Proc::Lock ( ... ); $lock->set (); die "locked" if $lock->isSet (); $lock->unset ();
Generic lock module. You must subclass this class and overwrite set, unset, isSet and new (possible) for do your work
Construct new lock object. You can setup parameters:
ProcessName => $name of process for make lock file name Pid => $ pid of process for make lock file name HostName => $ name of host for make lock file name Wait => wait for lock is clean and continue Timeout => limit of time of wait of lock clean NoUnset => not unset lock at unset operation
my $lock = new Proc::Lock... ( ProcessName => $0, Pid => $$, Hostname => gethostname(), Wait => 1, NoUnset => 1, Timeout => 30 ); $lock->set || die "already runned";
setup lock. Return true if success
unset lock, return true if success
return true if lock is up
destroy lock object
Return log object
private methods, You must put your functionality to this methods. The real methods ( set, unset, isSet ) call this method.
To install Proc::Application, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Proc::Application
CPAN shell
perl -MCPAN -e shell install Proc::Application
For more information on module installation, please visit the detailed CPAN module installation guide.