http://www.perlmonks.org?node_id=663508

chrism01 has asked for the wisdom of the Perl Monks concerning the following question:

Monks
I'm using Mime::Lite to send an email (with attachment) and I'm testing the error handling.
I can force an error easily enough and it appears in the logfile, but I want to trap the text so I can send an email (via Mail::Mailer) to sysadmin.
The only problem is that the error text is not stored in $! or $@, even if I wrap an eval around the $msg->send statement.

I've tried the web ( eg http://www.perlmonks.org/?node_id=239562) and super search (eg http://www.perlmonks.org/?node_id=563095), but the (very few) examples I've found all seem to assume the error text is in fact stored in $! or $@, as did I, but it deosn't actually seem to be so.

Anyone know how I can get it?

Cheers
Chris