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  -  FILE::FLOCK (3)

.ds Aq ’

NAME



 File::Flock - file locking with flock



CONTENTS

SYNOPSIS



 use File::Flock;

 lock($filename);

 lock($filename, shared);

 lock($filename, undef, nonblocking);

 lock($filename, shared, nonblocking);

 unlock($filename);

 lock_rename($oldfilename, $newfilename)

 my $lock = new File::Flock /somefile;

 $lock->unlock();

 $lock->lock_rename(/new/file);

 forget_locks();



DESCRIPTION

Lock files using the flock() call. If the file to be locked does not exist, then the file is created. If the file was created then it will be removed when it is unlocked assuming it’s still an empty file.

Locks can be created by new’ing a <B>File::FlockB> object. Such locks are automatically removed when the object goes out of scope. The <B>B>unlock()<B>B> method may also be used.

<B>B>lock_rename()<B>B> is used to tell File::Flock when a file has been renamed (and thus the internal locking data that is stored based on the filename should be moved to a new name). <B>B>unlock()<B>B> the new name rather than the original name.

Locks are released on process exit when the process that created the lock exits. Subprocesses that exit do not remove locks. Use forget_locks() or POSIX::_exit() to prevent unlocking on process exit.

SEE ALSO

See File::Flock::Subprocess for a variant that uses a subprocess to hold the locks so that the locks survive when the parent process forks. See File::Flock::Forking for a way to automatically choose between File::Flock and File::Flock::Subprocess.

LICENSE

Copyright (C) 1996-2012 David Muir Sharnoff <cpan@dave.sharnoff.org> Copyright (C) 2013 Google, Inc. This module may be used/copied/etc on the same terms as Perl itself.

PACKAGERS

File::Flock is packaged for Fedora by Emmanuel Seyman <emmanuel.seyman@club-internet.fr>.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 FILE::FLOCK (3) 2014-07-18

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