If your goal is to safely edit a file, without suffering nasty race conditions, the straightforward solution I concocted back in 2003 (and am still happy with) is to simply write a new file on the same file system ... and then use (atomic) rename to clobber the original file - but only after the new file has been successfully written. This is described in detail at:
In reply to Re: Using the file handle created by File::Temp to set specific file permissions
by eyepopslikeamosquito
in thread Using the file handle created by File::Temp to set specific file permissions
by mldvx4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |