|Subject:||"atomic" temp file on write error|
|Date:||Thu, 25 Nov 2010 11:40:56 +1100|
|To:||bug-File-Slurp [...] rt.cpan.org|
|From:||Kevin Ryde <user42 [...] zip.com.au>|
Nosing around File::Slurp 9999.13 I wondered if write_file() "atomic" mode may leave behind its temp file if it encounters a syswrite() error. The pod notes it may be left behind on various crashes or interrupts but I think it could helpfully be cleaned up for an error detected within write_file(). I suppose one possibility might be letting File::Temp or a similar scope-guarded thingie delete the file if not successfully reaching the rename stage. That might catch anything that at least goes through the normal exit().