Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Question about Flock and dieby converter (Priest) |
on Apr 06, 2003 at 00:25 UTC ( [id://248361]=note: print w/replies, xml ) | Need Help?? |
What if your open succeeds, but flock fails? You've already created a new lockfile. This probably won't hurt anything if the lockfile is empty, but if you should later decide to write something to the lockfile, a pid for example, you'll have a bug that will probably be very difficult to track down. dug mentioned File Locking Tricks and Traps (dug++), the Trap #3: Shutting the Barn Door etc. slide explains the problem and the slide that follows shows a better way to open the file.
In Section
Seekers of Perl Wisdom
|
|