Re: A procmail rule to filter perl.org messages.

[email protected] ((Johan Vromans)) 21 Aug 2000 11:54:16 +0200
Newsgroups perl.bootstrap
Message-ID <[email protected]>
Alan Burlison <[email protected]> writes:

> Jacob Davies wrote:
> 
> > Here's what I came up with for a first pass at it:
> > 
> >         LOGFILE=$HOME/.procmail-log
> >         MAILDIR=$HOME/Mail
> >         VERBOSE=on
> > 
> >         :0:
> >         * ^X-Mailing-List: contact \/(.*)-help
> >         $MATCH
> 
> [snip]
> 
> > If someone has a finer-tuned rule than this, excellent, send it on in!
> 
> Here's what I use:
> 
> PERL_LIST='(perl|bootstrap|scripts)[^@,;= ]*'
> :0 Wh: .perl-lists.lock
> * $ ^TO_\/${PERL_LIST}@perl\.org
> * MATCH ?? ^^\/[^@]+
> | formail -D 8192 .perl.msgid
>         :0 e:
>         perl-lists/$MATCH

Perl power to the people!

  use Mail::Procmail;
  pm_init();
  pm_deliver("perl-lists/$1")
    pm_gethdr("x-mailing-list") =~ /(\S+)-help\@perl.org/i;

Alternatively, 

  pm_deliver("perl-lists/$1")
    if pm_gethdr("x-mailing-list-name") =~ /^(\S+)/;

would suffice, thanks to Ask adding the X-Mailing-List-Name header.

-- Johan