$SIG{__DIE__} problem

B

bzd

Hello
I wrote a simple mail filtering script using Mail::Audit. It works
fine, but I'd like to overload DIE signal handler, so the script
would not send back "Undelivered Mail Returned to Sender" with
die output if there are any errors. It should just log exception
mesg or mail it directly to me.
I've tried
$SIG{__DIE__} = sub {
print LOG "DIE: ".$_[0];
$incoming_mail->ignore; # for Mail::Audit
}
but it doesn't work. $SIG{__DIE__} does work in simple testcase
though, like opening non-existing file, so I'm probabbly missing
something. Could anyone help?

regards,
artb.
 
N

nobull

bzd said:
I wrote a simple mail filtering script using Mail::Audit. It works
fine, but I'd like to overload DIE signal handler, so the script
would not send back "Undelivered Mail Returned to Sender" with
die output if there are any errors.

That does not sound like a good enough reason to use $SIG{__DIE__}.

For normal everyday execption handing use eval{}.

$SIG{__DIE__} is only for very special cases where you really need to
get involved in low-level stuff.

This newsgroup does not exist (see FAQ). Please do not start threads
here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top