RE: [Exim] limitations with embedded Perl

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: Mike Scott
CC: exim-users
Tárgy: RE: [Exim] limitations with embedded Perl
On Tue, 24 Jun 2003, Mike Scott wrote:

> You don't take enough credit for this thoughtful feature!!


I did not implement it, so I don't deserve any credit...

> #!/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?


I'm sorry, I can't answer that. I have no idea why that is failing
when the tie calls are included because I am not an embedded Perl guru.


--
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