IO::File::flock - extension of IO::File for flock
use IO::File::flock; or use IO::File::flock qw(:flock);# export LOCK_* # lock mode is automatically. $fh = new IO::File "> file" or die($!); # lock mode is LOCK_EX|LOCK_NB $fh = new IO::File "file",'>',LOCK_EX|LOCK_NB or die($!); # set timeout 5 second $fh = new IO::File "file",'>',LOCK_EX,5; if($@ && $@ =~ /TIMEOUT/){ #timeout } $fh->lock_ex(); # if write mode (w or a or +> or > or >> or +<) then default $fh->lock_sh(); # other then default $fh->lock_un(); # unlock $fh->flock(LOCK_EX|LOCK_NB); # get lock LOCK_EX|LOCK_NB
IO::File::flock inherits from IO::File.
IO::File::flock
IO::File
creates a IO::File::flock.
$fh->open(FILENAME,MODE) and $fh->flock(LOCK_MODE);
flock($fh,$LOCK_MODE);
$fh->flock(LOCK_EX);
$fh->flock(LOCK_SH);
$fh->flock(LOCK_UN);
Shin Honda (makoto[at]cpan.org,makoto[at]cpan.jp)
Copyright (c) 2003- Shin Honda. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
flock, Fcntl, IO::File,
To install IO::File::flock, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IO::File::flock
CPAN shell
perl -MCPAN -e shell install IO::File::flock
For more information on module installation, please visit the detailed CPAN module installation guide.