http://www.perlmonks.org?node_id=471535


in reply to Re^6: Writing to a file atomically without renaming
in thread Writing to a file atomically without renaming

Quite right... which is what I stated here, no argument from me.

Worst case scenario the cat of the backup_file to temp_file fails and you're left with a corrupt "file" and the extra "backup_file" which would have to be moved back manually.


Although moving the file over is another option in the case that this exception handling fails.. even if it does clobber the options, you can chmod it to at the least be group rw (or whatever it was before).

Fin
  • Comment on Re^7: Writing to a file atomically without renaming