With AMAVIS configured to deliver messages via
postscript the messages were inevetably bounced back to
the sender.
I noticed that in MTS/Postfix.pm, the $$args{'sender'}
and the $$args{'recipient'} were both equating to null.
by changing the while loop from
while (shift @ARGV) { ... }
to
foreach $_ (@ARGV) { ... }
the sender and the recipient both equated correctly and
messages started to be delivered.
AMAVIS - version 0.1.6.1
Postfix - 1.1.11.0-3
Linux - Debian testing/unstabale
Paddy de Burca
Logged In: YES
user_id=908349
Which perl version do you use? I've also got problems with
5.8.1.
Andrzej
Logged In: YES
user_id=886772
I am using
Perl 5.8.0
as supplied by the Debian woody testing/unstable
If you think of any thing I can try to do for you just let
me know.
Paddy.
Logged In: YES
user_id=908349
Have you upgraded perl recently? Well, according to perlvar
(1) the "while" loop should never work... I suppose Perl 5.8
became more strict in some areas and that is why it doesn't
work anymore.
Actually as $_ is implicit, you can just write
"for (@ARGV) { ... }"
Cheers
Logged In: YES
user_id=886772
I regullary do an apt-get update & apt-get upgrade - it is
quite possible that my version of Perl has been recently
upgraded.
I would totally agree with you about $_ being implicit IF
what were in the brackets were a <FILE_HANDLE>. As we are
looping through a list, I believe that $_ is not implicit
and needs to be defined explicitly.
I shall write a short perl scrict to confirm this and let
you know the outcome.
Paddy,
Logged In: YES
user_id=886772
The Perl script
my @list = (1, 2 ,3 ,4 ,5 ,6 ,7 ,8, 9);
print "\nFirst loop through the list\n";
foreach (@list) {
print;
}
print "\nSecond loop through the list\n";
foreach $_ (@list) {
print;
}
print "\nFinished.\n";
produces the following output
perl test.pl
First loop through the list
123456789
Second loop through the list
123456789
Finished.
The $_ is implicit. I shall look again at the amavis code to
see myself why/where it is going wrong.
Paddy.
Logged In: YES
user_id=886772
However,
my @list = (1, 2 ,3 ,4 ,5 ,6 ,7 ,8, 9);
print "\nFirst loop through the list\n";
foreach (@list) {
print;
}
print "\nSecond loop through the list\n";
foreach $_ (@list) {
print;
}
print "\nThird loop through the list\n";
while (shift @list) {
print;
}
print "\nFourth loop through the list\n";
while ($_ = shift @list) {
print;
}
print "\nFinished.\n";
Produces
perl test.pl
First loop through the list
123456789
Second loop through the list
123456789
Third loop through the list
Fourth loop through the list
Finished.
Therefor $_ is NOT implicit in a while loop. The foreach
loop implies the $_ but the while does not.
Paddy.
Logged In: YES
user_id=908349
> I shall write a short perl scrict to confirm this and let
> you know the outcome.
Well, actually reasoning by testing is not always a good
practice. If there is another bug in Perl, you will see what you
want, because your test program works that way. However it
doesn't mean that Perl was meant to do it that way, if you
know what I mean.
> Therefor $_ is NOT implicit in a while loop. The foreach
> loop implies the $_ but the while does not.
Here's complete explanation - Perl is meant to work THIS way:
Here are the places where Perl will assume $_ even if you
don't use it:
* Various unary functions, including functions like ord() and
int(), as well as the all file tests ("-f", "-d") except for
"-t", which defaults to STDIN.
* Various list functions like print() and unlink().
* The pattern matching operations "m//", "s///", and "tr///"
when used without an "=~" operator.
* The default iterator variable in a "foreach" loop if no
other variable is supplied.
* The implicit iterator variable in the grep() and map() func-
tions.
* The default place to put an input record when a "<FH>"
operation's result is tested by itself as the sole criterion of
a "while" test. Outside a "while" test, this will not hap-
pen.
In addition, "for" and "foreach" are synonyms in Perl -
described in perlsyn(1) and confirmed in real life :) - so you
can use them interchangeably.
Cheerz!