in reply to Re: Re: Flocking and In-place editing
in thread Flocking and In-place editing
You would have seen an error message like this:flock(ARGV,LOCK_EX) or die "flock failed: $!";
The problem is that the ARGV filehandle isn't open util you hit the while (<>) { line, so you can't lock it. After that, it's too late to lock. Follow one of the other suggestions, and either lock a separate lockfile, or write your own in-place edit code. The built-in $^I is nice for a quick script, but it's not always the best way to go.flock failed: Bad file descriptor at foo line 6.
|
---|