On 08/14/2009 04:31 PM, Ask Bjørn Hansen wrote:
On Aug 14, 2009, at 14:14, Jared Johnson wrote:
This should allow the logging/file plugin to log even if it isn't
called from
within a transaction
Thanks, applied and pushed.
The conditional around where you made the first change are a bit of a
mess (indicating that there's a better way to do whatever it does),
but I didn't look closer ... :-)
Well, I didn't have a closer look at logging/file itself, but I found
that it was Qpsmtpd::Transaction::DESTROY() that was trying to log with
$self->log() and failing. It looks like logging/file doesn't like the
empty hashref returned by Qpsmtpd::transaction(). The following patch
does clear up the issue for us, although a more general solution might
be in order. Thoughts?
index 125c9a5..6053259 100644
--- a/lib/Qpsmtpd.pm
+++ b/lib/Qpsmtpd.pm
@@ -408,8 +408,10 @@ sub run_hooks_no_respond {
my ($self, $hook) = (shift, shift);
if ($hooks->{$hook}) {
my @r;
+ my $transaction = $self if ( ref $self ) =~ /Transaction$/;
+ $transaction ||= $self->transaction;
for my $code (@{$hooks->{$hook}}) {
- eval { (@r) = $code->{code}->($self, $self->transaction,
@_); };
+ eval { (@r) = $code->{code}->($self, $transaction, @_); };
$@ and warn("FATAL PLUGIN ERROR [" . $code->{name} . "]:
", $@) and next;
if ($r[0] == YIELD) {
die "YIELD not valid from $hook hook";
-Jared
- ask
--
-----BEGIN ANTISPAM SIGNATURE-----
DoubleCheck identified this message as CLEAN. If this is incorrect, help
improve accuracy:
Classify this message as SPAM:
http://mg1.nmgi.com/message/spam?token=rv.R1EgQhrnd
More options:
http://mg1.nmgi.com/message/details?token=rv.R1EgQhrnd
-----END ANTISPAM SIGNATURE-----