in reply to Re^5: instantiating an smtp object
in thread instantiating an smtp object

Hi $h4X4_|=73}{,

I'll admit that I've never personally encountered the eval/$@ bug in the wild (yet), and the code in question does say use 5.014;. But, although admittedly unlikely, it's not impossible that Net::SMTP might someday update its DESTROY method with some code that still exhibits a form of the bug, or that the use 5.014; statement is removed later and the code is run on a lower version of Perl, or that the code is copy-and-pasted and used somewhere else where the bug suddenly shows up, and so on. So I still think that eval { ...; 1 } or ... is "better" (more reliable at detecting eval failures) than eval { ... }; if ($@) ..., and that it's a good habit to get into.

Regards,
-- Hauke D

Replies are listed 'Best First'.
Re^7: instantiating an smtp object
by $h4X4_|=73}{ (Monk) on Jun 07, 2016 at 08:22 UTC

    You are absolutely right about eval. I was basing my usage of Net::SMTP before Steve Hay got his grubby hands on it and put eval all over it like he knows what he is doing.

    Your not supposed to use eval that much and in the case of sending mail. Normally sending mail is last action you would be doing, so eval will work out good. But as the way Net::SMTP is made today. I would not use it anymore. Someone needs to take that name space back. Instead of making up a new namespace Email because of crappy modules "Net::SMTP" . Then no one tells me and I get to post bad info on a thread and run crappy modules that are bugs for about 3 years now.

    It makes it very hard for me to trust any Perl module these days.