Author: hmbrand
Date: Thu May 6 02:11:30 2010
New Revision: 13944
Modified:
dbi/trunk/lib/DBD/File.pm
Log:
Cleanup/DESTROY should close (Jens)
Modified: dbi/trunk/lib/DBD/File.pm
==============================================================================
--- dbi/trunk/lib/DBD/File.pm (original)
+++ dbi/trunk/lib/DBD/File.pm Thu May 6 02:11:30 2010
@@ -734,7 +734,7 @@
binmode $fh or croak "Failed to set binary mode on $file: $!";
}
}
- if ($locking and $fh) {
+ if ($locking && $fh) {
my $lm = defined $data->{Database}{f_lock}
&& $data->{Database}{f_lock} =~ m/^[012]$/
? $data->{Database}{f_lock}
@@ -776,6 +776,7 @@
# We have to close the file before unlinking it: Some OS'es will
# refuse the unlink otherwise.
$self->{fh} and $self->{fh}->close ();
+ undef $self->{fh};
unlink $self->{file};
return 1;
} # drop
@@ -802,6 +803,13 @@
return 1;
} # truncate
+sub DESTROY
+{
+ my $self = shift;
+ $self->{fh} and $self->{fh}->close ();
+ undef $self->{fh};
+ } # DESTROY
+
1;
__END__
@@ -1026,9 +1034,9 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2009 by H.Merijn Brand & Jens Rehsack
-Copyright (C) 2004 by Jeff Zucker
-Copyright (C) 1998 by Jochen Wiedmann
+Copyright (C) 2009-2010 by H.Merijn Brand & Jens Rehsack
+Copyright (C) 2004-2009 by Jeff Zucker
+Copyright (C) 1998-2004 by Jochen Wiedmann
All rights reserved.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.