Tidy filters

Marco d'Itri md@Linux.IT
Sat Jul 12 16:38:21 CEST 2003


On Jul 12, Steve Crook <steve@bananasplit.info> wrote:

 >So my question is:  Is there a way I can host all these filter expressions
 >in a file with one on each line rather than having them all in my
 >cleanfeed.local file in one long statement?
You can start from this:

open(FILE, "...") or report_failure ...;
my @badurls = <FILE>;
close FILE;
chomp @badurls;
map { s/\./\\./g } @badurls;	# beware, not everything is escaped
my $badurl = '(?:|' . join('|', @badurls) . ')';
undef @badurls;

sub local_filter_first {
    if ($hdr{__BODY__} =~ /$badurl/o) {
        reject(...);
    }
}

-- 
ciao, |
Marco | [784 taUhXcmYG3nng]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.bofh.it/pipermail/cleaners/attachments/20030712/548f5e45/attachment.pgp>


More information about the cleaners mailing list