I am writing a CGI app that will execute a program and mail a user the output. The program runs for a long time so I close and reopen STDOUT, STDERR, and STDIN to /dev/null to send apache an EOF. This does not seem to jive well with Net::SMTP. When I comment out the lines:
close STDIN;
close STDOUT;
close STDERR;
open STDIN, "</dev/null";
open STDOUT, ">/dev/null";
open STDERR, ">/dev/null";
Net::SMTP sends email without problem. No warning or error messages appear in the apache error log, nor when I execute the script from shell.
When I uncomment those lines and run the command in a shell, it still works, mail is sent as usual. However, now when run in a browser mail will not get sent. I do not run the smtp server or I would look in the logs whether it connects or not. This makes me think it might be an apache issue and not perl.
I am using the standard redhat apache install with a standard redhat perl.
Tell me if it would be useful to have the full code. It is quite long so I will post it in a separate node.
Here are my version numbers:
Server version: Apache/2.0.48
Server built: Feb 26 2004 23:02:17
This is perl, v5.8.0 built for i386-linux-thread-multi
I am running perl with -T if that makes a difference.
$Net::SMTP::VERSION = 2.24
Thanks in advance.
Update: It seems that the issue is with closing and reopening both STDOUT and STDERR. Closing either individually allows Net::SMTP to function. Could this be a LANG issue with utf8?