On Thu, 24 Nov 2005, Roland Pope wrote:
Actually, I do like debugging my scripts and see what's going on in there.
I used to do the following when I tested my filter's _begin/../end stage
heavily:
I've added this code into the filter:
action_quarantine_entire_message("Message quarantined
because for TESTING purpose");
get_quarantine_dir();
foreach my $fnam (glob('*')) {
if(-f $fnam && !-e "$QuarantineSubdir/$fnam") {
if(open(OUT, ">$QuarantineSubdir/$fnam"))
{
if(open(IN, $fnam)) {
while(<IN>) {
print OUT;
}
close IN;
}
close OUT;
}
}
}
The "foreach" loop causes that all files are available in the quarantined
directory, incl COMMANDS, which is essential.
Then you can check the filter doing this:
$ cd $QuarantineSubdir
$ rm -r RESULT Work
$ perl -d mimedefang.pl -f filter $(pwd)
c do_scan
c filter_begin
... do the debugging
q
$ test -f RESULTS && cat RESULTS || echo no results
However, if you do not check the logic of the filter itself, but some
general problem, you must be aware that you debug as the defang-user (the
demon runs as), that you cannot emulate the timings and that a slave may
have leftover values of a previous run.
Bye,
--
Steffen Kaiser
_______________________________________________
Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list
[email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang