[Exim] domainlist localdomains perl expansion

Top Page
Delete this message
Reply to this message
Author: Jez Hancock
Date:  
To: Exim Users List
Subject: [Exim] domainlist localdomains perl expansion
Hi,

I'm having trouble getting a perl script to expand a list of domains from a sendmail style
local-host-names file (ie one domain per line).

I've added:

perl_startup = do '/usr/local/etc/exim/exim.pl'

to my configure file and the script looks like:

-------------------------------------------------------------------------------
#!/usr/bin/perl
use strict;

my $lhd_file="/etc/mail/local-host-names";

sub get_lhd() {
    my $hosts = "";
    open(FD, "$lhd_file");
    foreach(<FD>){
        chomp($_);
        $hosts.=" : $_ ";
    }
    close FD;
    return $hosts;
}
-------------------------------------------------------------------------------


The script has been tested in a shell and returns a string of the form:
: example1.com : example2.com : example2.com

as expected.

The problem is with the expansion line I'm using in the Exim configure file:

domainlist local_domains = @ ${perl{get_lhd}}

Which yields:

[8:52:31] root@darkstar /usr/local/etc/exim# exim -bP +local_domains
domainlist local_domains = @ : example.com : ${perl{get_lhd}}

on HUP.

How would/should I use perl expansion in this context?

Thanks in advance,
Jez