MIME::Lite uses a harcoded require Net::SMTP;, so you can't tell it to use something else without modifying its code (or perhaps using an @INC hook, but that's fairly advanced and not something I'd necessarily recommend over the following). One possible approach would be to place your own version of Net::SMTP in @INC before any other paths with e.g. lib. However, this requires your version of Net::SMTP to also be called Net::SMTP, which means you'd need to copy Net::SMTP and modify it... personally, I actually think your suggestion of making a new module that inherits from MIME::Lite to be more elegant than that!

However, note in general you probably want to consider switching to one of the newer Email::* modules by RJBS, the current maintainer of MIME::Lite - the documentation of that module starts with:

MIME::Lite is not recommended by its current maintainer. There are a number of alternatives, like Email::MIME or MIME::Entity and Email::Sender, which you should probably use instead. MIME::Lite continues to accrue weird bug reports, and it is not receiving a large amount of refactoring due to the availability of better alternatives. Please consider using something else.

In reply to Re: Replacing a module dependency by haukex
in thread Replacing a module dependency by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.