in reply to Temporary text files with File::Temp

As a small aside, on Unix at least the use of Temp::File-generated temp files is inappropriate if you are using it for the purpose of atomic overwrite.

The reason is that most of the time /tmp is not on the same partition as the file you want to overwrite, so the resulting system move command to move the file into place is not atomic, it has to copy the bitstream.

If you want atomic overwrite, you HAVE to write the initial file to somewhere on the same partition as the target, which generally means to the same directory.
  • Comment on Re: Temporary text files with File::Temp

Replies are listed 'Best First'.
Re^2: Temporary text files with File::Temp
by Anonymous Monk on Feb 27, 2008 at 06:15 UTC
    File::Temp allows you to write the temp file to any directory you choose. There is no requirement to have it end up in /tmp.