capturing error in MIME::Lite

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I have

use Net::SMTP;
use MIME::Lite;
.. ... ...
$msg->send or die "error in email";

I thought the die would capture any error.  If the email address is not
vaild I get:

Software error:
SMTP recipient() command failed:
virtual alias table

Why isn't die capturing the error?


Re: capturing error in MIME::Lite

John wrote:
Quoted text here. Click to load it

Presumably it is getting the error before send returns, so it never
gets to the 'or die'.  Are you assuming that die does something like
try-catch in other languages?  For that you want to use eval or
the TryCatch module.

Site Timeline