logging $! with $r->log_error
am 10.12.2010 17:59:23 von Mark CopperHi all,
I stole this snippet years ago (and probably modified it improperly)
only to learn yesterday it has a serious problem:
unless(open MAIL, "| /usr/sbin/sendmail -t -i -F'...' -f'...''"){
$main::r->log_error("Couldn't open mail: $!");
return DECLINED;
}
namely this error:
[Thu Dec 09 16:32:44 2010] [error] [client ...] Can't call method
"log_error" on an undefined value at ...
resulting in a 500 HTTP response (which I want very much to avoid).
I can just remove the offending "$!", of course, but is then I won't
get the error message when it *does* get set.
So my question: when "open" to a pipe does not return a process PID
and $! is not set, is there any other source of information regarding
what caused the error?
I'm pretty ignorant on this type of thing, so sorry if it's a stupid question.
Mark