Skip Menu |

This queue is for tickets about the File-Slurp CPAN distribution.

Report information
The Basics
Id: 63318
Status: resolved
Priority: 0/
Queue: File-Slurp

Owner: Nobody in particular
Requestors: user42 [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: "atomic" temp file on write error
Date: Thu, 25 Nov 2010 11:40:56 +1100
To: bug-File-Slurp [...]
From: Kevin Ryde <user42 [...]>
Download (untitled) / with headers
text/plain 527b
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().
Download (untitled) / with headers
text/plain 139b
the rename call is now error checked (and tested in t/error.t). all you need to do is wrap the write_file call in eval to trap any errors.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to