[Mimedefang] Using MD variables from a .pl file
Jan-Pieter Cornet
johnpc at xs4all.nl
Wed Apr 18 11:08:09 EDT 2007
On Wed, Apr 18, 2007 at 04:15:12AM -0400, Oliver Schulze L. wrote:
> I'm doing some development with MD have created an object or calls.
> I then call :
> require "myfile.pl";
>
> from filter_end() in mimedefang-filter. The problem I'm getting is that
> I could not use/see MD variables like $Sender.
>
> I'm don't if it is ok what I'm doing. Any tips are welcome.
>
> Example core:
> -----------
> #myfile.pl
> package myclass;
>
> sub test1() {
> print "$Sender\n";
> }
>
> 1;
> -------
> The error in maillog is:
> Global symbol "$Sender" requires explicit package name ...
You're referring to $myclass::Sender. A possible solution is what
Steffen suggests: explicitly write $::Sender or $main::Sender.
Another possibility is to look at the modularized mimedefang-filter
that I've developed, which allows you to selectively "import" the
mimedefang variables in your own package. It's at:
http://www.xs4all.nl/~johnpc/mimedefang-modular/
You'd use it like:
package myclass;
use Mimedefang '$Sender';
sub test1 {
print "$Sender\n";
}
PS, helpful hint: do not use function prototypes (the brackets after
"sub SUBNAME"), they're useless (and ignored) for object-oriented
programming and deprecated for every other purpose.
--
Jan-Pieter Cornet <johnpc at xs4all.nl>
!! Disclamer: The addressee of this email is not the intended recipient. !!
!! This is only a test of the echelon and data retention systems. Please !!
!! archive this message indefinitely to allow verification of the logs. !!
More information about the MIMEDefang
mailing list