X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Farm%2Flibio-stringy-perl%2Fio-stringy-2.110%2Fdocs%2FIO%2FAtomicFile.pm.html;fp=dev%2Farm%2Flibio-stringy-perl%2Fio-stringy-2.110%2Fdocs%2FIO%2FAtomicFile.pm.html;h=9ab688a3ca26e2413869b8092871858db768693f;hp=0000000000000000000000000000000000000000;hb=f477fa73365d491991707e7ed9217b48d6994551;hpb=da95c414033799c3a62606f299c3c00b5c77ca11 diff --git a/dev/arm/libio-stringy-perl/io-stringy-2.110/docs/IO/AtomicFile.pm.html b/dev/arm/libio-stringy-perl/io-stringy-2.110/docs/IO/AtomicFile.pm.html new file mode 100644 index 0000000..9ab688a --- /dev/null +++ b/dev/arm/libio-stringy-perl/io-stringy-2.110/docs/IO/AtomicFile.pm.html @@ -0,0 +1,104 @@ + + + IO::AtomicFile 2.101 + + +ZeeGee Software

IO::AtomicFile 2.101

+
+ + +


+

Top NAME

+ + +

IO::AtomicFile - write a file which is updated atomically + + + +


+

Top SYNOPSIS

+ +
+    use IO::AtomicFile;
+
+
+    ### Write a temp file, and have it install itself when closed:
+    my $FH = IO::AtomicFile->open("bar.dat", "w");
+    print $FH "Hello!\n";
+    $FH->close || die "couldn't install atomic file: $!";    
+
+
+    ### Write a temp file, but delete it before it gets installed:
+    my $FH = IO::AtomicFile->open("bar.dat", "w");
+    print $FH "Hello!\n";
+    $FH->delete; 
+
+
+    ### Write a temp file, but neither install it nor delete it:
+    my $FH = IO::AtomicFile->open("bar.dat", "w");
+    print $FH "Hello!\n";
+    $FH->detach;   
+
+ + +


+

Top DESCRIPTION

+ + +

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. + + +

But this module gives you true atomic updates, via rename(). +When you open a file /foo/bar.dat via this module, you are actually +opening a temporary file /foo/bar.dat..TMP, and writing your +output there. The act of closing this file (either explicitly +via close(), or implicitly via the destruction of the object) +will cause rename() to be called... therefore, from the point +of view of the outside world, the file's contents are updated +in a single time quantum. + + +

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. + + + +


+

Top AUTHOR

+ + +

Eryq (eryq@zeegee.com). +President, ZeeGee Software Inc (http://www.zeegee.com). + + + +


+

Top REVISION

+ + +

$Revision: 2.101 $ + +


+
+Generated Sun Dec 21 13:54:37 2003 by cvu_pod2html +
+
+