Cool File & Directory Modules IO::AtomicFile 33 of 69 : prev | index | next



Writes a file which is updated atomically.

This module is intended for people who need to update files reliably in the face of unexpected program termination. For example, you generally don't want to be halfway in the middle of writing /etc/passwd and have your program terminate! Even the act of writing a single scalar to a filehandle is not atomic.

Note: To ensure that problems do not go undetected, the "close" method done by the destructor will raise a fatal exception if the rename() fails. The explicit close() just returns undef.

You can also decide at any point to trash the file you've been building.

© 2003 Barbie - contents