in reply to More Eyes, Please

There is really no point in flocking a temp file that you've just destroyed. If someone else was using it, too bad, you've just killed their data.

Once you've flocked the input file, are you now the only one that is doing the operation? If so, no more flocking is needed. Just create your temp file, and rename over it, or whatever you were going to do at the end.

However, flocking a file you will be renaming over the top is a bit problematic. I've posted other code here that shows a template for that at Exclusively updating a file that continues to be repeatedly read.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE (tilly) 2: More Eyes
by tilly (Archbishop) on Aug 22, 2000 at 15:41 UTC
    *laugh*

    At the exact moment merlyn was noticing that you were destroying the temp file on open, le and I were discussing a problem that turned out to be his not being able to flock a file he had destroyed on open.

    With your original code change how you open the temp file and see if that makes it work for you. If it does then I definitely learned something interesting today. :-)