From procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)de Thu Oct 13
10:19:06 2011
Subject: Re: Long line of OR
From: LuKreme <kremels(_at_)kreme(_dot_)com>
Date: Thu, 13 Oct 2011 09:19:22 -0600
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
On 12 Oct 2011, at 12:08 , Professional Software Engineering wrote:
You may however see more of an improvement by optimizing your regexp:
(a(a|psumo|dmin)|b(eni|smith)|c(andy|asa|f|pr)|d(b|bl|hosts)|fb|g(lue|ofobo)|hita|ic|l(lc|ogi)|micr|netf|ocb|p(lus|l)|r(smith|oot|cc|k|ocb)|s(cv|nap|pot|u)|t(or|ripa|wit)|v(365|m))
Readability takes a big dive though.
Readability is important, especially since the list changes every now and
again.
Again, youd need to run benchmarks - put recipes in a sandbox, run against
a large corpus several times, omitting the longest and shortest times
(owing to the effects of cache, etc), and would need to run it on a host
which didn't have other demands on it.
OK, I was afraid I was forgetting something like maximum line length or
something like that.
There *is* a max line length. You're nowhere close to it, as the _default_
value is 2048 characters, And it can be arbitrarily increased by setting
the LINEBUFF variable. man procmqilrc is your friend
I have recipe conditions that make the one you're 'wondering' about look
like a toy; I've never had to increase LINEBUF, _yet_ anyway.
Also, for 'readability'` I'm known to do things like:
LIST="( word1 \
| word2 \
| word3 \
| word4 \
)"
LIST=`echo ${LIST} |tr -d '\t '`
Whereupon, the recipe looks something like:
:0
* ${LIST}
action
I tend to make -heavy- use of variables in .procmailrc. It greatly
improves the readability of the actual recipies -- you don't have to
reverse-engineer complex regexes _every_time_ you look at the file
to figure out what theyere doing.
I've got one medium-complex .procmailrc -- for an address that is the
is the submission address for a moderated newsgroup and a mailing
list -- 524 lines. It has 101 lines of comments, 75 blank lines, and
108 lines of variable assignements, and 79 recipes with a total of 71
condition tests. Many of the recipes simply do a variable assignment,
selecting which one of several mailboxes the message will ultimately
be delivered to. A few recipes call for more than one action, so there
are chained 'And' recipes with no conditions.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail