Hi Ernesto,

On Fri, Aug 31, 2007 at 04:10:30AM +0200, Ernesto wrote:
> trying to inherit from a plugin I ran into a problem:
> 
> Plugin: /usr/share/qpsmtpd/plugins/extended_rcpt_to
> 
> sub init
> {
>       my $self = shift;
>       print STDERR __PACKAGE__, "::init...\n";
>       $self->isa_plugin ( "rcpt_to" );
> }
> 
> 
> Configure: /etc/qpsmtpd/plugins
> ...
> extended_rcpt_to
> rcpt_ok
> ...
> 
> (Logging is LOGDEBUG)
> 
> gives on console:
> 
> dienstleistung-kultur:~# invoke-rc.d qpsmtpd restart
> Qpsmtpd::Plugin::extended_rcpt_to::init...
> could not open plugins/rcpt_to: No such file or directory at
>       /usr/share/perl5/Qpsmtpd/Plugin.pm line 121.
> invoke-rc.d: initscript qpsmtpd, action "restart" failed.
> dienstleistung-kultur:~#
> 
> and in logfile:
> ...
> [11872]: check_attachment hooking data_post
> [11872]: trying to get config for plugin_dirs
> [11872]: Loading extended_rcpt_to from
>       /usr/share/qpsmtpd/plugins/extended_rcpt_to
> --- EOF ---

I think I've seen something similar, which turned out to be a bug
in the 0.40 isa_plugin code not handling multiple plugin_dirs 
properly. Patch attached. Not sure if it's your problem but it 
smells similar.

Cheers,
Gavin


=== modified file 'lib/Qpsmtpd/Plugin.pm'
--- lib/Qpsmtpd/Plugin.pm       2007-02-10 10:19:37 +0000
+++ lib/Qpsmtpd/Plugin.pm       2007-02-25 21:35:22 +0000
@@ -117,9 +117,16 @@
   # don't reload plugins if they are already loaded
   return if defined &{"${newPackage}::plugin_name"};
 
+  # find $parent in plugin_dirs
+  my $parent_dir;
+  for ($self->qp->plugin_dirs) {
+    $parent_dir = $_ and last if -e "$_/$parent";
+  }
+  die "cannot find plugin '$parent'" unless $parent_dir;
+
   $self->compile($self->plugin_name . "_isa_$cleanParent",
                     $newPackage,
-                    "plugins/$parent"); # assumes Cwd is qpsmtpd root
+                    "$parent_dir/$parent");
   warn "---- $newPackage\n";
   no strict 'refs';
   push @{"${currentPackage}::ISA"}, $newPackage;

Reply via email to