Re: [Exim] embedded Perl

Pàgina inicial
Delete this message
Reply to this message
Autor: Nigel Metheringham
Data:  
A: E.A.Joseph
CC: exim-users
Assumpte: Re: [Exim] embedded Perl
e.a.joseph@??? said:
> I've made the assumption that exim.pl (with path) is the perl
> subroutine needed for perl initialisation (exim.pl is the name of my
> perl subroutine).


> Exim fails to expand the below condition: (director: missing or
> misplaced
> or } )


> condition= "${if eq ${perl{exim.pl}{$sender_address}{$local_part}{yes}{
> no}}}"


It looks like you are confusing filenames and subroutine/fuction names
here. That exim.pl in the condition call looks particularly suspicious
(does perl allow periods in function names?).

You want something like this....
First in /some/path/exim_subs.pl

#!/usr/bin/perl

  # sample - tests that the 2 addresses passed are case insensitive 
equal
  sub test_equality {
    my $addr1 = shift;
    my $addr2 = shift;


    return (lc($addr1) eq lc($addr2));
  }


1; # need this if its going to be a module
# end

and then your exim config would be something like

perl_at_start = yes
perl_startup = 'do /some/path/exim_subs.pl'

...
condition = "${perl{test_equality}{$sender_address}{$local_part}}"

So the perl subroutine name goes in the perl{} parameter.

However your syntax error is more fundemental:-

condition= "${if eq ${perl{exim.pl}{$sender_address}{$local_part}{yes}{
no}}}"

should be

condition= "${if eq ${perl{exim.pl}{$sender_address}{$local_part}}{yes}
{no}}}"

I think - at least you need an additional } to match the opening one on
${perl

    Nigel.


-- 
[ Nigel Metheringham           Nigel.Metheringham@??? ]
[ Phone: +44 1423 850000                         Fax +44 1423 858866 ]
[ - Comments in this message are my own and not ITO opinion/policy - ]