Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Auto flock

by Tommy (Chaplain)
on Nov 19, 2012 at 23:41 UTC ( #1004636=note: print w/replies, xml ) Need Help??

in reply to Auto flock

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 +andle
$ perl -MMIME::Base64 -e 'print decode_base64 "YWNlQHRvbW15YnV0bGVyLm1lCg=="'

Replies are listed 'Best First'.
Re^2: Auto flock
by space_monk (Chaplain) on Nov 20, 2012 at 02:46 UTC

    I get the impresssion that the OP is aware of the various methods of locking, but wants a way of making the code lock files without making any changes to the (already existing) main body of code.

    I couldn't quite get that far in my earlier suggestion, but thought a 1 letter regex was a close as you could get. ;-)

    A Monk aims to give answers to those who have none, and to learn from those who know more.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004636]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2018-05-22 14:50 GMT
Find Nodes?
    Voting Booth?