perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Copper <mcop...@titaninterface.com>
Subject logging $! with $r->log_error
Date Fri, 10 Dec 2010 16:59:23 GMT
Hi 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

Mime
View raw message