Thanks for that Captain Obvious. I wasn't assuming anything Yes, your program assumes that ->new will succeed, since you wrote it, you assumed that - I clearly pointed out that the method call is failing, but it's unclear why. Sure it is, its because ->new failed and $smtp is undef
#!/usr/bin/perl --
use Net::SMTP;
Net::SMTP->new(
) or print "DANG!\n\$! @{[int$!]} $!\n\$^E @{[int$^E]} $^E\n\$@ $@ ";
print "\n", '#' x 10, "\n";
Net::SMTP->new(
Host => '127.0.0.1',
Port => '6666',
Timeout => 0.1,
) or print "DANG!\n\$! @{[int$!]} $!\n\$^E @{[int$^E]} $^E\n\$@ $@ ";
print "\n", '#' x 10, "\n";
__END__
DANG!
$! 2 No such file or directory
$^E 10038 An operation was attempted on something that is not a socket
$@
##########
DANG!
$! 10060 A connection attempt failed because the connected party did n
+ot properly respond after a period of time, or established connection
+ failed because connected host has failed to respond.
$^E 6 The handle is invalid
$@ Net::SMTP: connect: timeout
##########
|