[EXIM] Exim-perl patch 0.2

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Malcolm Beattie
Fecha:  
A: exim-users
Asunto: [EXIM] Exim-perl patch 0.2
I've written a rather better Exim-perl integration patch and made
it available as

    ftp://ftp.ox.ac.uk/pub/perl/exim-perl-0.2.patch


The patch file is 11K and includes the following instructions and
documentation:

Description

This is a patch to exim-2.02 to support embedded Perl code in Exim's
string manipulation language. You can apply this patch safely to a
standard Exim 2.02 distribution since it does not change the default
build configuration of Exim.

Installation

Apply this patch by changing to the top level directory of the Exim
distribution (exim-2.02) and typing

    patch -p0 < /path/to/this/patch/file


You do not need to remove this explanatory section at the beginning
of the patch file: patch will automatically find the patch itself.


In order to make use of the Perl support, you need version 5.004 or
later of Perl installed on your system. The ordinary procedure of
configuring Exim should be followed: after copying src/EDITME to
Local/Makefile in the normal way and editing the result, look for the
commented section beginning "Compiling in support for embedded Perl".
Follow the accompanying instructions by uncommenting the four lines
which define EXIM_PERL, PERL_CC, PERL_CCOPTS and PERL_LIBS. Then
continue to configure and build Exim as usual.

Usage

This patch adds a new global configuration file option (perl_startup)
and a new Exim string manipulation operator (${perl...}). If there is
no perl_startup option in the Exim configuration file then no Perl
interpreter is started and there is almost no overhead for Exim
(since none of the Perl library will be paged in unless used). If
there is a perl_startup option then the associated value is taken to
be Perl code which is executed in a newly created Perl interpreter
right after the configuration file is read for the first time. The
perl_startup code is taken to be a raw string and is not
string-expanded in the Exim sense so you do not need to backwhack
any characters to escape special meanings. The perl_startup option
should usually be something like
    perl_startup = do '/etc/exim.pl'
where /etc/exim.pl is Perl code which defines any subroutines you
want to use from Exim.


If a configuration file includes a perl_startup option then it then
make use of the new Exim string manipulation operator to call Perl
subroutines (those previously defined by the perl_startup code).
The operator is used as follows
    ${perl{foo}{argument}}
and the resulting string is the return value of calling Perl
subroutine foo on the given argument. If the sub returns the
undefined value then the expansion fails and Exim panics with the
error message: Perl sub "foo" returned undef. If the sub throws an
exception via 'die "foo\n"' then the expansion fails and Exim
panics with the error message passed to "die".


--Malcolm

--
Malcolm Beattie <mbeattie@???>
Unix Systems Programmer
Oxford University Computing Services

--
*** Exim information can be found at http://www.exim.org/ ***