title: "Can't call method "auth" on an undefined value at..." after many successful runs
body: <p>i have a perl app that is supposed to send emails to a massive number of recipients. It seems to work ok, but after about 9K emails it fails with:</p>
  
  <pre><code>    Can't call method "auth" on an undefined value at...
  </code></pre>
  
  <p>In the code I see:</p>
  
  <pre><code>    # Open a connection to the SendGrid mail server
      my $smtp = Net::SMTP-&gt;new('smtp.xyz.net', Port=&gt; 25, Hello=&gt;$DOMAIN);
  
      # Authenticate
      my $code = $smtp-&gt;auth($USERNAME, $PASSWORD);
  </code></pre>