[Mimedefang] Re: modular filter (was DNS Lookups in MD)

Paul Murphy Paul.Murphy at argentadiscovery.com
Tue Jul 24 04:44:56 EDT 2007


> But here is what doesn't work for me:

> #AT SOME POINT DEFINE A VARIABLE IN MIMEDEFANG
> my $auth_sender = some_routine();

> #THEN TRY AND INCLUDE MY SNIPPET
> do "file.pl"

> #Contents of file.pl is just bare code:

> if ($auth_sender > 0) {
>  #do stuff
> }

> 1;

> Perhaps all I need to do is change $auth_sender in file.pl to 
> $main::auth_sender?

Possibly - all of my included files are subroutines, so I've not played with using code snippets in individual files.

However, the documentation includes this: 		my highlight in "||||"

—--------------------------------------
do EXPR 
Uses the value of EXPR as a filename and executes the contents of the file as a Perl script. Its primary use is to include subroutines from a Perl subroutine library.

      do 'stat.pl';  

is just like

      eval `cat stat.pl`;  

except that it's more efficient and concise, keeps track of the current filename for error messages, searches the @INC libraries, and updates %INC if the file is found. See perlvar/Predefined Names for these variables. It also differs in that code evaluated with do FILENAME ||||cannot see lexicals in the enclosing scope||||; eval STRING does. It's the same, however, in that it does reparse the file every time you call it, so you probably don't want to do this inside a loop.
—--------------------------------------

Maybe if you use the "eval" form it will work?

Paul.

-- 

-------------------------------------------------------
Paul Murphy
Head of I.T.
Argenta Discovery
Tel. 01279 645 554
Fax. 01279 645 646



_______________________________________________________________________
Argenta Discovery Ltd, 8-9 Spire Green Centre, Harlow, Essex, CM19 5TR
Registered in England No. 3671653
_______________________________________________________________________ 




More information about the MIMEDefang mailing list