-
-
18 Jul 2014 00:44:53 UTC
- Distribution: File-Flock
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (2)
- Testers (2045 / 93 / 0)
- Kwalitee
Bus factor: 0- % Coverage
- License: unknown
- Activity
24 month- Tools
- Download (12.49KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- AnyEvent
- Data::Structure::Util
- File::Slurp
- IO::Event
- Test::SharedFork
- Time::HiRes
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
Why not adopt me?
This distribution is up for adoption! If you're interested then please contact the PAUSE module admins via email.NAME
File::Flock::Subprocess - file locking with flock in a subprocess
SYNOPSIS
use File::Flock::Subprocess; 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
This is a wrapper around File::Flock that starts a subprocess and does the locking in the subprocess with File::Flock. The purpose of this is to handle operating systems (eg: Solaris) that do not retain locks across a call to fork().
The sub-process for this is created with fork() when File::Flock::Subprocess is compiled. I've tried to minimize the side-effects calling fork() by doing calling it early and by using POSIX::_exit() to quit but it is still worth being aware of. I suggest loading File::Flock::Subprocess early.
Use File::Flock::Forking to automatically detect when this is needed.
Read the docs for File::Flock for details of the API.
ERRATA
Any errors reported by the locking proxy File::Flock::Subprocess starts will be reported as "Compilation Failed" errors because the proxy is started in a BEGIN{} block.
LICENSE
Copyright (C) 2013 Google, Inc. This module may be used/copied/etc on the same terms as Perl itself.
Module Install Instructions
To install File::Flock, copy and paste the appropriate command in to your terminal.
cpanm File::Flock
perl -MCPAN -e shell install File::Flock
For more information on module installation, please visit the detailed CPAN module installation guide.