Using File::Util will do this for you automatically.
use File::Util; my $ftl = File::Util->new(); # write to a file: (It is automatically locked) $ftl->write_file(file => '/foo/bar/baz.txt', content => 'blah blah bla +h'); # read from a file: (It is automatically locked) my $content = $ftl->load_file("/foo/bar/baz.txt"); # to get an open filehandle that is automatically locked, # see http://search.cpan.org/~tommy/File-Util-3.30_003/Util.pod#open_h +andle
In reply to Re: Auto flock
by Tommy
in thread Auto flock
by AlfaProject
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |