diff --git a/lib/Qpsmtpd/Transaction.pm b/lib/Qpsmtpd/Transaction.pm index 0ce8db9..3e17bb5 100644 --- a/lib/Qpsmtpd/Transaction.pm +++ b/lib/Qpsmtpd/Transaction.pm @@ -102,4 +102,16 @@ sub body_getline { } +sub DESTROY { + my $self = shift; + # would we save some disk flushing if we unlinked the file before + # closing it? + + undef $self->{_body_file} if $self->{_body_file}; + if ($self->{_filename} and -e $self->{_filename}) { + unlink $self->{_filename} or $self->log(0, "Could not unlink ", $self->{_filename}, ": $!"); + } +} + + 1;