Re: MailBox: How to capture Script warnings
Mark Overmeer <[email protected]> Tue, 31 Aug 2004 17:48:26 +0200
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Organization | MARKOV Solutions |
| Message-ID | <[email protected]> |
Hi Jan,
I was lucky to see your request in the archive: I get that much spam
these days, that I do sometimes delete important messages unread. It's
horrible. Please refer to 'MailBox' in the subject.
> How does one get access to the "Connection reset by peer" and the
> "Timeout" warning from the debug output below?
> $sender = Mail::Transport::SMTP->new(hostname => $mxserver, smtp_debug=>1);
> ($success, $errorcode, $errortext, $errorlocation, $quitsuccess)
> = $sender->trySend($msg);
The other errors are produced in the IO::Socket::Inet layer of Net::SMTP.
As far as I could figure-out, that is simply sending errors to stderr
and dieing. So:
eval { $sender = Mail::Tr....; my @out = $sender->trySend($msg) }
if($@ =~ m/Timeout/) { .... }
... and/or take a look at $! ...
Those core Perl modules are not the cleanest you can encounter, so it's
not that obvious how you can catch the errors cleanly.
--
MarkOv
------------------------------------------------------------------------
drs Mark A.C.J. Overmeer MARKOV Solutions
[email protected] [email protected]
http://Mark.Overmeer.net http://solutions.overmeer.net