
wog
stranger
Nov 26, 2001, 4:22 PM
Post #2 of 6
(572 views)
|
|
Re: What is wrong with this code...?
[In reply to]
|
Can't Post
|
|
You have two problems in your program. First, you use things like eval("$relayhost = ($relayhost || virtual_host);"); What happens here is that $relayhost is first put into the string and then you try to execute the resulting code and, obviously, fail. You can fix your problem using single quotes, though I'd reccommend using eval BLOCK calls instead. (You'll just need to change your "use" into a "require", so it doesn't run at compile-time). Note that after any eval, you can get information on the failure from $@. It would be wise, at least while debugging, to check this after every eval. In your sendmail-using code you output a newline before starting the headers. Sendmail treats that initial newline as ending message headers and thus also won't work. Note that in your sendmail code you should check the return of close; often when there is a problem running something, you will not know this until the close has completed. In the event of error, you can get the return code of sendmail from $? (which will help you fiquire out what's wrong).
|