On Fri, 07 Mar 2008 10:02:09 -0800
[EMAIL PROTECTED] wrote:

> I'm trying to write a plugin that uses hook_helo_parse but am not having 
> any success. Some debugging shows my function gets called, it returns a 
> CODE ref, but the ref'd sub never gets called here's a simple example:
[...]
> When run I see the first alert, but not the second- does anyone else 
> have a plugin using this hook that's working? I'm using qpsmtpd-0.40 and 
> the async server if that makes any difference.

Yup, found the place where it broke. I'll commit to svn. The diff below
should fix it for you, too.

        Hanno

Index: lib/Qpsmtpd.pm
===================================================================
--- lib/Qpsmtpd.pm      (revision 871)
+++ lib/Qpsmtpd.pm      (revision 872)
@@ -461,7 +461,9 @@
     last unless $r[0] == DECLINED;
   }
   $r[0] = DECLINED if not defined $r[0];
-  @r = map { split /\n/ } @r;
+  # hook_*_parse() may return a CODE ref..
+  # ... which breaks when splitting as string:
+  @r = map { split /\n/ } @r unless (ref($r[1]) eq "CODE");
   return $self->hook_responder($hook, [EMAIL PROTECTED], $args);
 }
 

Reply via email to