IPC::SRLock::Base - Common lock object attributes and methods
package IPC::SRLock::<some_new_mechanism>; use Moo; extents 'IPC::SRLock::Base';
This is the base class for the factory subclasses of IPC::SRLock. The factory subclasses all inherit from this class
Defines the following attributes;
debug
Turns on debug output. Defaults to 0
exception_class
Class used to throw exceptions
log
If set to a log object, it's debug method is called if debugging is turned on. Defaults to Class::Null
name
Used as the lock file names. Defaults to ipc_srlock
ipc_srlock
nap_time
How long to wait between polls of the lock table. Defaults to 0.5 seconds
patience
Time in seconds to wait for a lock before giving up. If set to 0 waits forever. Defaults to 0
pid
The process id doing the locking. Defaults to this processes id
time_out
Time in seconds before a lock is deemed to have expired. Defaults to 300
BUILDARGS
Extract "debug" and "log" attribute values from the builder object if one was supplied
builder
get_table
my $data = $lock_obj->get_table;
Returns a hash ref that contains the current lock table contents. The keys/values in the hash are suitable for passing to HTML::FormWidgets
list
my $array_ref = $lock_obj->list;
Returns an array of hash refs that represent the current lock table
reset
$lock_obj->reset( k => 'some_resource_key', ... );
Resets the lock referenced by the k attribute.
k
set
$lock_obj->set( k => 'some_resource_key', ... );
Sets the specified lock. Attributes are;
Unique key to identify the lock. Mandatory no default
p
Explicitly set the process id associated with the lock. Defaults to the current process id
t
Set the time to live for this lock. Defaults to five minutes. Setting it to zero makes the lock last indefinitely
Default arguments for the set method
Sleep for a bit or throw a timeout exception
Return the text of the the timeout message
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Larry Wall - For the Perl programming language
Peter Flanigan, <pjfl@cpan.org>
<pjfl@cpan.org>
Copyright (c) 2017 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install IPC::SRLock, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IPC::SRLock
CPAN shell
perl -MCPAN -e shell install IPC::SRLock
For more information on module installation, please visit the detailed CPAN module installation guide.