This old node reminded me of an anecdote that happened a few years ago. There was this CGI script I inherited that was supposed to send feedback from a web form - in other words, a really simple affair. The customer complained that they kept losing feedback messages sent with the form: their customers followed up on the feedback wondering why nothing happened, and found out their feedback hadn't been received in the first place.
When I looked at the script, the problem was obvious: it did the equivalent of
...end of script.if(open MAIL, "|/usr/lib/sendmail") { print MAIL <<EOF; content of form EOF } else { print "error message"; }
One close later, the customer was happy... Seems that the script did manage to send the message in some circumstances (probably when the print happened to take place in conjunction with a buffer flush), which mislead the the original author.
The lesson: "good enough" isn't. Even when it appears to work.
In reply to Close your filehandle - a simple fix for a cgi script by jsiren
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |