Name
IPC::SRLock::Base - Common lock object attributes and methods
Synopsis
package IPC::SRLock::<some_new_mechanism>;
use Moo;
extents 'IPC::SRLock::Base';
Version
This documents version v0.19.$Rev: 1 $ of IPC::SRLock::Base
Description
This is the base class for the factory subclasses of IPC::SRLock. The factory subclasses all inherit from this class
Configuration and Environment
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
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
Subroutines/Methods
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.
set
$lock_obj->set( k => 'some_resource_key' );
Sets the specified lock. Attributes are:
k
-
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
throw
Expose the throw
method in File::DataClass::Exception
timeout_error
Return the text of the the timeout message
_list
Should be implemented in the factory subclass
_reset
Should be implemented in the factory subclass
_set
Should be implemented in the factory subclass
Diagnostics
None
Dependencies
Incompatibilities
There are no known incompatibilities in this module
Bugs and Limitations
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Acknowledgements
Larry Wall - For the Perl programming language
Author
Peter Flanigan, <pjfl@cpan.org>
License and Copyright
Copyright (c) 2013 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