procmail
[Top] [All Lists]

Re: Perl scripts not recognized as such?

2008-12-04 12:34:30

Thank you for your reply.

The permissions should be ok:

animas: ls -l billo2.pl
-rwxr-xr-x   1 billo    staff       338 Dec  4 08:11 billo2.pl*

Also, I think the syntax is ok when it's interpreted as a Perl script;
the problem seems to occur when, for some reason, it's interpreted as
a shell script.  Consider the following:

Here the "#!" line is intact, and the script runs:

animas: head -2 billo2.pl
#!/usr/local/perl/bin/perl
#
animas: echo "^Subject: test" | ./billo2.pl

Here the "#!" line is disabled, and the script fails with the error
I'm seeing in the procmail log:

animas: head -2 billo2.pl
##!/usr/local/perl/bin/perl
#
animas: echo "^Subject: test" | ./billo2.pl
./billo2.pl[5]: my:  not found
./billo2.pl[6]: my:  not found
./billo2.pl[8]: my:  not found
./billo2.pl[10]: syntax error at line 10 : `)' unexpected
animas: 

So I think the question is why the "#!" line isn't always recognized.

Bill

in the stupid question category: Have you checked your permissions to
ensure that the script is executable?

Also check your script.  you have an error there somewhere (probably
line 10)

/home/staff/billo/Mail/billo2.pl: syntax error at line 10: `)' unexpected

--Curtis

Bill Oakley wrote:
Hello,

I'm using procmail to spool my "interesting" mail to my system mailbox
and my "uninteresting" mail to a secondary mailbox.  Specifically, I'm
using a Perl script and testing it's exit status.  My recipes are:

:0Wi:
* ? $HOME/Mail/billo2.pl
$HOME/Mail/billo2

:0:
$DEFAULT

My Perl script begins with:

#!/usr/local/perl/bin/perl

The problem I'm seeing is that sometimes the Perl script doesn't seem
to be recognized as a Perl script; my procmail log file contains:

procmail: Executing "/home/staff/billo/Mail/billo2.pl"
/home/staff/billo/Mail/billo2.pl: my: not found
/home/staff/billo/Mail/billo2.pl: my: not found
/home/staff/billo/Mail/billo2.pl: my: not found
/home/staff/billo/Mail/billo2.pl: syntax error at line 10: `)' unexpected
procmail: Non-zero exitcode (2) from "/home/staff/billo/Mail/billo2.pl"
procmail: No match on "/home/staff/billo/Mail/billo2.pl"

It's as though the Perl script is being interpreted as a shell script.
(And if I remove the "#!" line and run the script interactively I see
the same errors.)  But again, this only happens some of the time - the
rest of the time the script runs and the messages are spooled
correctly.

Any ideas about what the problem may be?

Thank you for your help.

Bill
____________________________________________________________
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