From a2cc40f14d32f8f38fff0391d91ea9c0d64315ec Mon Sep 17 00:00:00 2001 From: fukachan Date: Sun, 25 Feb 2001 06:43:41 +0000 Subject: clean up documents move FML::String to Dialect::ISO2022JP (Dialect::Japanese::String) --- fml/lib/IO/File/Atomic.pm | 59 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 5 deletions(-) (limited to 'fml/lib/IO/File') diff --git a/fml/lib/IO/File/Atomic.pm b/fml/lib/IO/File/Atomic.pm index ed2d06f6..f6bbb093 100644 --- a/fml/lib/IO/File/Atomic.pm +++ b/fml/lib/IO/File/Atomic.pm @@ -22,16 +22,16 @@ END {} =head1 NAME -IO::Atomic - atomic operation +IO::Atomic - atomic IO operation =head1 SYNOPSIS use IO::Atomic; my $wh = IO::Atomic->open($file); print $wh "new/updated things ..."; - $wh->close; + $wh->close unless $wh->error; -So, in usual cases, you use in this way. +So, in usual cases, you use this module in the following way. use FileHandle; use IO::Atomic; @@ -43,7 +43,7 @@ So, in usual cases, you use in this way. my $wh = IO::Atomic->open($file); while (<$rh>) { print $wh "new/updated things ..."; - } + } $wh->close; $rh->close; @@ -65,7 +65,14 @@ To copy from $src to $dst, =head1 DESCRIPTION library to wrap atomic IO operations. -The C feature is based on C call. +The C feature is based on C system call. + +=head1 METHODS + +=head2 C + +The usual constructor. +The request is forwarded to SUPERCLASS new(). =cut @@ -84,6 +91,29 @@ sub new } +=head2 C + +open C with C. +If C is not specified, open C with writable mode by default. + +Actually this method openes a new temporary file for write. +So to write this C is to write the temporary file. +When close() method sucesses, the file is replaced with this temporary file, +so updated. + +=head2 C + +return the read and write file descriptor. +This is a wrapper for C method above for conveninece. + +=head2 C + +close the file. +After the file is closed, the file is renamed to the original file name. + +=cut + + # Descriptions: open( $file [, $mode] ) # open not $file but file.new.$$ # forward open() request to IO::File class @@ -156,6 +186,14 @@ sub close } +=head2 C + +copy from C file to C file in atomic way by using +C. + +=cut + + # Descriptions: copy file, which ensures atomic operation # Arguments: $self source_file destination_file # Side Effects: $dst's file mode becomes the same as $src @@ -181,6 +219,17 @@ sub copy } +=head2 C + +return the error. + +=head2 C + +stop the operation. remove the temporary file. + +=cut + + # Descriptions: return error message # Arguments: $self # XXX $self is blessed file handle. -- cgit v1.2.1