in reply to Re^3: File Locking Problem
in thread File Locking Problem

It doesn't, but you will at least be able to open a filehandle (you just have to hope that the interval between the two is small enough that you won't run into problems). It's not an ideal solution, certainly, but is there a way to open a read/write handle on a file without clobbering it if it does exist and that won't fail if the file doesn't exist?

Replies are listed 'Best First'.
Re^5: File Locking Problem
by Anonymous Monk on Jul 29, 2004 at 13:11 UTC
    Perhaps you could try touching the file and then opening the read/write handle. If the file isn't there, touch will create it. If the file is there, touch won't hurt it (unless the timestamp is of importance to you, but if you're about to write to it you're going to change that anyway). The only danger is that the file might be deleted in between the touch and the open, but that should be a relatively short danger zone (and it will make the code a bit simpler).