Michael Kulakov > Proc-Application-0.01 > Proc::Lock

Download:
Proc-Application-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.5   Source  

NAME ^

Proc::Lock - lock interface module

SYNOPSIS ^

 use Proc::Lock;
 my $lock = new Proc::Lock ( ... );
 $lock->set ();
 die "locked" if $lock->isSet ();
 $lock->unset ();

DESCRIPTION ^

 Generic lock module. You must subclass this class and overwrite set, unset, isSet and new (possible) for do your work

new

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";

set

setup lock. Return true if success

unset

unset lock, return true if success

isSet

return true if lock is up

DESTROY

destroy lock object

log

Return log object

_set _unset _isSet

private methods, You must put your functionality to this methods. The real methods ( set, unset, isSet ) call this method.

syntax highlighting: