in reply to Re: Net::SMTP undef weirdness
in thread Net::SMTP undef weirdness

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: Net::SMTP undef weirdness
by Anonymous Monk on Aug 25, 2012 at 13:25 UTC

    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 ##########
Re^3: Net::SMTP undef weirdness
by noisey (Initiate) on Aug 27, 2012 at 04:15 UTC
    OK, I take that back. Sorry - your reply seemed narky.

      OK, I take that back. Sorry - your reply seemed narky.

      Its all good :) all self-evident truths seem snarky when stated -- I should have been more explicit/specific about which call failed

      The Basic debugging checklist says 7. Check the return (error) status of your commands , the same goes for methods, including constructors :)

      Though in all honesty, I was feeling snarky that day :)