Hi xiaolan,

On Mon, 9 Apr 2012 16:13:36 +0800
xiaolan <practicalp...@gmail.com> wrote:

> Hi,
> 
> I just want to send email using MIME::Lite with Net::SMTP::SSL.
> But MIME::Lite is going only with Net::SMTP by default.
> So I searched and found a hack:
> 
> use Net::SMTP::SSL;
> BEGIN { @MIME::Lite::SMTP::ISA = qw(Net::SMTP::SSL); }
> 
> This does work, now I can send messages with SMTPs.
> But how does this work? Thank you.
> 

The @ISA variable (which is specific for each package) determines which packages
the current package inherits from. Note that in Perl 5, classes are
implemented as packages. One can mutate the inheritance graph at run-time by
changing the @ISA's of the various packages involved. This is usually not
recommended, but as you demonstrate here - it is still useful. 

There's more information about it in the various perldocs, and some older
tutorials (and the book Modern Perl covers it too), but there are more
recommended ways to initially populate the packages’ @ISA, namely the extends()
function when using Moose or friends, and "use base" (and the more modern "use
parent") when not.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Original Riddles - http://www.shlomifish.org/puzzles/

Bill Gates, CEO of Microsoft decides to use Richard Stallman’s Emacs as the
basis of his company’s state‐of‐the‐art product Microsoft Editing Macros™
Enterprise Edition XP .NET Professional.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to