in reply to Re: Re: Small Net::SMTP problem
in thread Small Net::SMTP problem
The easiest way to hide this error may be to use a variation of the redirect example from open. This works on UNIX:
open(OLDERR, ">&STDERR"); open(STDERR, "/dev/null"); eval { my $smtp = Net::SMTP->new('relay.utah-inter.net') }; open(STDERR, ">&OLDERR"); die $@ if $@;
But I don't know what the equivalent to /dev/null is on Windows. Note that just closing STDERR doesn't work, because warn() and die() won't produce output even after STDERR is reopened to OLDERR. I'm not sure why that is.
The eval/die is because, while you want to avoid that warning, if Net::SMTP->new() dies for some reason you want to know about it.
|
|---|