summaryrefslogtreecommitdiff
path: root/fml/lib/IO/Adapter/AtomicFile.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-12-22 02:54:12 +0000
committerfukachan <fukachan>2002-12-22 02:54:12 +0000
commit3ef16f3fb2fd86aaf0904fa177b90d4339684b67 (patch)
treedda811501eac9ea16386f107b849226aabd0197d /fml/lib/IO/Adapter/AtomicFile.pm
parentffd175cf1e2a2b291290ba70aa1d6dca79d7072a (diff)
downloadfml8-3ef16f3fb2fd86aaf0904fa177b90d4339684b67.tar.gz
fml8-3ef16f3fb2fd86aaf0904fa177b90d4339684b67.tar.bz2
fml8-3ef16f3fb2fd86aaf0904fa177b90d4339684b67.zip
cometics. fix comments.
defined() check before $fh->close().
Diffstat (limited to 'fml/lib/IO/Adapter/AtomicFile.pm')
-rw-r--r--fml/lib/IO/Adapter/AtomicFile.pm17
1 files changed, 10 insertions, 7 deletions
diff --git a/fml/lib/IO/Adapter/AtomicFile.pm b/fml/lib/IO/Adapter/AtomicFile.pm
index d13796ca..866ad224 100644
--- a/fml/lib/IO/Adapter/AtomicFile.pm
+++ b/fml/lib/IO/Adapter/AtomicFile.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: AtomicFile.pm,v 1.3 2002/09/11 23:18:20 fukachan Exp $
+# $FML: AtomicFile.pm,v 1.4 2002/09/22 14:56:58 fukachan Exp $
#
package IO::Adapter::AtomicFile;
@@ -82,7 +82,7 @@ The request is forwarded to SUPER CLASS's new().
=cut
-# Descriptions: ordinary constructor
+# Descriptions: ordinary constructor.
# forward new() request to superclass (IO::File)
# XXX returned object $self is blessed file handle.
# Arguments: OBJ($self)
@@ -91,7 +91,8 @@ The request is forwarded to SUPER CLASS's new().
sub new
{
my ($self, @argv) = shift;
- my $me = $self->SUPER::new();
+ my $me = $self->SUPER::new(); # call IO::File::new().
+
if (defined $me) {
$me->open(@argv) if @argv;
return $me;
@@ -192,7 +193,9 @@ sub close
my $temp = ${ *$fh }{ _temp_file };
# XXX close the "write" file handle (write .. to $temp file)
- close($fh);
+ if (defined $fh) {
+ $fh->close();
+ }
if (rename($temp, $orig)) {
return 1;
@@ -271,14 +274,14 @@ sub error
sub rollback
{
my ($self) = @_;
- my $fh = $self;
+ my $fh = $self;
my $temp = ${ *$fh }{ _temp_file };
if (-f $temp) { unlink $temp;}
}
-# Descriptions: destructor
-# forward the request to rollback() in this class
+# Descriptions: destructor.
+# forward the request to rollback() in this class.
# Arguments: OBJ($self)
# XXX $self is blessed file handle.
# Side Effects: none