Thank you for your reply, I'll try to answer your questions...
Q: If it is so simple, how come you're not doing these checks within
procmail itself, which would be less costly?
It's simple now, because it's proof-of-concept. When I have this
working the filtering will become more complex. I'm not sure how much
more complex, but I thought Perl would better suited for "arbitrarily"
complex filtering. For example, one thing I might do is extract
substrings from a regular expression match; is this possible with
procmail's regular expressions? Plus I know Perl, so there's the
advantage of not learning another syntax.
# Note that explicitly delivering to default, if it is the last action of
# your rcfile, isn't really necessary. If you were doing this prior to the
# end of the rcfile, it'd be different.
:0:
$DEFAULT
Thank you for the tip, I didn't pick up on that in my reading.
As to your perl problems:
What version of perl? Use 'perl -v'
This is perl, v5.8.8 built for sun4-solaris-64int
What is your shell set to (as procmail sees it)?
I'm not setting the shell in my .procmailrc, so it's whatever the
default is. My command is so simple - no command line arguments,
quoting, meta-characters - is the shell relevant? But whatever the
shell, it should be consistent for all procmail invocations, and the
problem I'm seeing is inconsistent behavior - sometimes the script is
interpreted as a Perl script, and sometimes it's (apparently)
interpreted as a shell script.
Is mail processed on the SAME host that you shell to?
This is a not uncommon issue with large ISPs - your procmail script
may be invoked by a host other than the one you shell into, and thus
settings (and tool versions) are not consistent with where you shell.
This is not through an ISP; I'm logged in to the Solaris machine which
is our mail and file server. procmail, Perl, the Perl script and
/var/mail physically reside on the machine, and procmail runs on the
machine.
From your post, there's a syntax error at line 10 - which shows a
closing PARENTHESIS, not brace. Your posted code has a closing brace
on line 10 though. Do you have more than one copy of this script?
There's only one copy of the script. I made some minor changes to the
script which caused the entries in the procmail log (which predated
the changes) to no longer match the script. (Specifically, I added an
RCS "$Id: $" line and removed some unused variables - nothing which
affected the behavior of the script.) I just looked at a more recent
entry in the procmail log (which postdates the changes to the script),
and the line in question is:
while (<STDIN>) {
As I've mentioned previously, the syntax errors captured in the
procmail log are exactly those I see when I invoke the Perl script as
a shell script (by disabling the "#!" line).
Out of habit, you should add -wT to the perl commandline.
Doesn't have
an effect in this particular case, but is a good practice.
I wondered about Perl command line options and looked at spamassassin,
which also includes -wT. I'll add them.
Bill
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
____________________________________________________________
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
____________________________________________________________
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