Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

paranoid::lockfile(3pm) [debian man page]

Paranoid::Lockfile(3pm) 				User Contributed Perl Documentation				   Paranoid::Lockfile(3pm)

NAME
Paranoid::Lockfile - Paranoid Lockfile support VERSION
$Id: Lockfile.pm,v 0.65 2011/12/08 07:53:07 acorliss Exp $ SYNOPSIS
use Paranoid::Lockfile; $rv = plock($lockfile); $rv = punlock($lockfile); $rv = pcloseLockfile($lockfile); DESCRIPTION
This modules provides a relatively safe locking mechanism across multiple processes. This does not work over NFS or across remote systems, this is only intended for use on a single system at a time, and only on those that support flock. sysopen is used to avoid race conditions with multiple process attempting to create the same file simultaneously. SUBROUTINES
/METHODS plock $rv = plock($filename); This function attempts to safely create or open the lockfile. It uses sysopen with O_CREAT | O_EXCL to avoid race conditions with other processes. Returns a true if successful. Your can pass an optional second argument which would be a string of either 'write' or 'shared'. The default is 'write', which locks the file in exclusive write mode. You can pass an optional third argument which would be the lockfile filesystem permissions if the file is created. The default is 0600. NOTE: This function will block until the advisory lock is granted. punlock $rv = punlock($filename); This function removes any existing locks on the specified filename using flock. If no previous lock existed or it was successful it returns true. This does not, however, close the open filehandle to the lockfile. pcloseLockfile $rv = pcloseLockfile($filename); This function releases any existing locks and closes the open filehandle to the lockfile. Returns true if the file isn't currently open or the operation succeeds. DEPENDENCIES
o Fcntl o Paranoid o Paranoid::Debug BUGS AND LIMITATIONS
AUTHOR
Arthur Corliss (corliss@digitalmages.com) LICENSE AND COPYRIGHT
This software is licensed under the same terms as Perl, itself. Please see http://dev.perl.org/licenses/ for more information. (c) 2005, Arthur Corliss (corliss@digitalmages.com) perl v5.14.2 2011-12-08 Paranoid::Lockfile(3pm)

Check Out this Related Man Page

Paranoid::Log::Buffer(3pm)				User Contributed Perl Documentation				Paranoid::Log::Buffer(3pm)

NAME
Paranoid::Log::Buffer - Log Buffer Functions VERSION
$Id: Buffer.pm,v 0.83 2010/06/03 19:03:46 acorliss Exp $ SYNOPSIS
use Paranoid::Log; enableFacility('events', 'buffer', 'debug', '+'); enableFacility('more-events', 'buffer', 'debug', '+', 100); @messages = Paranoid::Log::Buffer::dump($name); DESCRIPTION
This module implements named buffers to be used for logging purposes. Each buffer is of a concrete size (definable by the developer) with a max message length of 2KB. Each message is stored with a timestamp. Once the buffer hits the maximun number of entries it begins deleting the oldest messages as the new messages come in. Buffers are created automatically on the fly, and messages trimmed before being stored. With the exception of the dump function this module is not meant to be used directly. Paranoid::Log should be your exclusive interface for logging. When enabling a buffer facility with Paranoid::Log you can add one integral argument to the call. That number defines the size of the log buffer in terms of number of entries allowed. NOTE: Buffers are maintained within process memory. If you fork a process from a parent with a log buffer each copy will maintain its own entries. SUBROUTINES
/METHODS NOTE: Given that this module is not intended to be used directly nothing is exported. init log remove Paranoid::Log::Buffer::dump @entries = Paranoid::Log::Buffer::dump($name); This dumps all current entries in the named buffer. Each entry is an array reference to a two-element array. The first element is the timestamp of the message (in UNIX epoch seconds), the second the actual message itself. DEPENDENCIES
o Paranoid::Debug SEE ALSO
o Paranoid::Log BUGS AND LIMITATIONS
AUTHOR
Arthur Corliss (corliss@digitalmages.com) LICENSE AND COPYRIGHT
This software is licensed under the same terms as Perl, itself. Please see http://dev.perl.org/licenses/ for more information. (c) 2005, Arthur Corliss (corliss@digitalmages.com) perl v5.14.2 2010-06-03 Paranoid::Log::Buffer(3pm)
Man Page