Is anyone else seeing this in high_perf?

The log message would look something like this:
        Can't call method "log" on an undefined value at 
.../lib/Qpsmtpd/Plugin.pm line 47.
(That line number will be off because I've modified Plugin.pm.)

When a Danga callback is called, a call to Plugin's connection or log
method fails because the $self->{_qp} is undefined.  My guess is that
$self->{_qp} is out of scope because $self->{_qp} is set with
'local $self->{_qp} = ...'.

I have modified high_perf somewhat for my own setup, so if no one else is
seeing this on the mainline high_perf, I'd like to know that too.

I have a workaround, but it seems there should be a more elegant way to fix
this.  My workaround is demonstrated by changing this code in the
plugins/require_resolvable_fromhost check_dns() method:

--- /tmp/Plugin.pm-     2005-04-26 13:21:30.000000000 -0600
+++ /tmp/Plugin.pm      2005-04-26 13:21:38.000000000 -0600
@@ -26,14 +26,15 @@
     return $self->transaction->notes('resolvable', 1)
         if $host =~ m/^\[(\d{1,3}\.){3}\d{1,3}\]$/;

+       my $qp = $self->qp;
     Danga::DNS->new(
-        callback => sub { $self->dns_result(@_) },
+        callback => sub { local $self->{_qp} = $qp ; $self->dns_result(@_) },
         host => $host,
         type => "MX",
         client => $self->qp->input_sock,
     );
     Danga::DNS->new(
-        callback => sub { $self->dns_result(@_) },
+        callback => sub { local $self->{_qp} = $qp ; $self->dns_result(@_) },
         host => $host,
         client => $self->qp->input_sock,
     );


Brian

Reply via email to