Applied-ish (fixed it another way).

On Wednesday, Jul 23, 2003, at 20:05 Europe/London, Meng Weng Wong wrote:

if config/me is absent, Qpsmtpd.pm will consult sub config's %defaults.
In scalar context, those defaults will return correctly, but in array
context, this produces the error

@400000003f1edacd2400aacc 32000 FATAL PLUGIN ERROR: Can't use string ("dumbo.pobox.com") as an ARRAY ref while "strict refs" in use at lib/Qpsmtpd.pm line 41, <STDIN> line 3.

This patch defines the default config values in [], and returns the
first element when they are used in scalar context.

*** Qpsmtpd.pm.~1.24.~  Mon Jul  7 23:10:48 2003
--- Qpsmtpd.pm  Wed Jul 23 15:00:10 2003
***************
*** 29,36 ****
    #warn "SELF->config($c) ", ref $self;

    my %defaults = (
!                 me      => hostname,
!                 timeout => 1200,
                  );

    my ($rc, @config) = $self->run_hooks("config", $c);
--- 29,36 ----
    #warn "SELF->config($c) ", ref $self;

    my %defaults = (
!                 me      => [hostname],
!                 timeout => [1200],
                  );

my ($rc, @config) = $self->run_hooks("config", $c);
***************
*** 42,48 ****
return @config;
}
else {
! return ($config[0] || $self->get_qmail_config($c, $type) || $defaults{$c});
}
}


--- 42,48 ----
return @config;
}
else {
! return ($config[0] || $self->get_qmail_config($c, $type) || $defaults{$c}->[0]);
}
}






Reply via email to