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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.