develooper Front page | perl.bootstrap | Postings from August 2000

Re: A procmail rule to filter messages.

Thread Previous
August 17, 2000 00:04
Re: A procmail rule to filter messages.
Message ID:
[Quoting Jacob Davies, on August 16 2000, 13:54, in "A procmail rule to f"]
> I got tired of adding a procmail rule for each new mailing list,
> so I made a procmail rule that can automatically filter them.
> [...] The procmail \/
> regex marker and $MATCH only seem to be able to break off the right hand
> side of a matched expression, there's no equivalent of $1 that I could see.

Exactly for this reason I finally decided to dump procmail and write
an alternative. It's called Mail::Procmail and available on CPAN.

(And yes, I _was_ heavily insprired by Simon Cozen's Mail::Audit.) 

> If someone has a finer-tuned rule than this, excellent, send it on in!

This is the relevant section from my filter:

for ( pm_gethdr("x-mailing-list"),
    ) {

    my ($topic, $host);

    if ( ($topic, $host) = /($wordpat)@($wordpat)/i ) {

	if ( $host eq "" ) {
	    $topic = "perl6-bootstrap" if lc eq "bootstrap";
	    $topic = "perl-" . $topic unless $topic =~ /^perl/;
	$topic =~ s/-help$//;

    pm_deliver(maillist($topic)) if defined $topic;

-- Johan

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About