RE: [Exim] limitations with embedded Perl

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Mike Scott
Fecha:  
A: exim-users
Asunto: RE: [Exim] limitations with embedded Perl
Philip,

You don't take enough credit for this thoughtful feature!!
I no stranger to chapter 12 (or chapter 17 in O'Reilly), but it is way too
general to help me. My experience is that a Perl script that runs
interactively, won't necessarily run embedded. For example:

#!/usr/bin/perl -Pw
use strict;
use DB_File;
sub isSpam {
my $message_id = Exim::expand_string('$message_id');
my %database = ();
tie %database, "/tmp/exim.db", O_RDONLY;
untie %database;
return ($message_id);
}

Obviously, this is a VERY simplistic example. As is, it will crash with the
following message in the Exim log:
error in filter file: failed to expand "${perl{isSpam}}\n" in logwrite
command: Undefined subroutine &main::isSpam called.

If I comment out the tie/untie calls, the script completes correctly (and
returns the message ID to my filter). Back to the gist of my original
question: what are the limitations of a Perl script that runs embedded?

Now, I am making one BIG assumption - that my system is configured
correctly! My mail server was built by a very experienced contractor:
Slackware Linux, Exim 3.22, Perl 5.005. This baby runs 24x7 and is rock
solid.

Mike Scott

-----Original Message-----
From: Philip Hazel [mailto:ph10@cus.cam.ac.uk]
Sent: Tuesday, June 24, 2003 8:50 AM
To: Dan Muey
Cc: Mike Scott; exim-users@???
Subject: RE: [Exim] limitations with embedded Perl


On Tue, 24 Jun 2003, Dan Muey wrote:

> I'm with you Mike, I'm interested in finding some documentation about it.
> If you could embed Perl into the mail processing guts you could really
> implement some powerful features.


There's not much to say about it other than what the manual says
(chapter 12 - just over a page long). I don't use it because it is
clearly expensive, but there are people that do.

The provided facility is the ability to call Perl from within an Exim
expansion string. This is not a general "let Perl loose on the message"
feature, though I suppose it could be if you called it from a
local_scan() function.

> > Why is there so
> > little information on its use and capabilities (or limitations)?


I suspect it is not widely used, but that's just a guess.

Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book