GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PATH::CLASS::FILE::LOCKABLE (3)

.ds Aq ’

NAME

Path::Class::File::Lockable - lock your files with Path::Class::File

CONTENTS

SYNOPSIS



 my $file = Path::Class::File::Lockable->new(path/to/file);
 $file->lock;
 # do stuff with $file
 $file->unlock;



DESCRIPTION

Path::Class::File::Lockable uses simple files to indicate whether a file is locked or not. It does not use flock(), since that is unstable over NFS. Effort has been made to avoid race conditions.

Path::Class::File::Lockable is intended for long-standing locks, as in a Subversion workspace. See SVN::Class for example.

METHODS

This is a subclass of Path::Class::File. Only new or overridden methods are documented here.

    lock_ext

Returns the file extension used to indicate a lock file. Default is .lock.

    lock_file

Returns a Path::Class::File object representing the lock file itself. No check is made as to whether the lock file exists.

    lock_info

Returns a colon-limited string with the contents of the lock file. Will croak if the lock file does not exist.

<B>NoteB> that the owner and timestamp in the file contents are not from a stat() of the file. They are written at the time the lock file is created. So chown’ing or touch’ing a lock file do not alter its status.

See lock_owner() and lock_time() for easier ways to get at specific information.

    lock_owner

Returns the name of the person who locked the file.

    lock_time

Returns the time the file was locked (in Epoch seconds).

    lock_pid

Returns the PID of the process that locked the file.

    locked

Returns true if the file has an existing lock file.

lock( [owner] )

Acquire a lock on the file.

This method should be NFS-safe via File::NFSLock.

    unlock

Removes lock file. Uses system() call to enable unlinking across NFS. Will croak on any error.

AUTHOR

Peter Karman, <karman at cpan.org>

BUGS

Please report any bugs or feature requests to bug-path-class-file-lockable at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Path-Class-File-Lockable>. I will be notified, and then you’ll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.



    perldoc Path::Class::File::Lockable



You can also look for information at:
o AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Path-Class-File-Lockable>

o CPAN Ratings

<http://cpanratings.perl.org/d/Path-Class-File-Lockable>

o RT: CPAN’s request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Path-Class-File-Lockable>

o Search CPAN

<http://search.cpan.org/dist/Path-Class-File-Lockable>

ACKNOWLEDGEMENTS

There are lots of lock file modules on CPAN. Some of them are probably better suited to your needs than this one.

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

SEE ALSO

File::NFSLock, Path::Class::File

COPYRIGHT & LICENSE

Copyright 2007 by the Regents of the University of Minnesota. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PATH::CLASS::FILE::LOCKABLE (3) 2012-08-02

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.