Um, AutoLoader and autouse are different modules that do somewhat related things. Both try to delay actually loading code to runtime. If you might not need to load the code, that can be a win. If you do load the code then you'd have beeen far better off doing it up front. (There are many penalties with doing things at runtime, for instance you blow the functionmethod cache.) In general I'd lean towards using neither, seeing both as Premature Optimization until the need is proven, and the win is demonstrable.

Of the two, I'd prefer autouse because it doesn't complicate the development process nearly as much. Also AutoLoader installs an AUTOLOAD (see perlsub for details) and those get in the way in many scenarios (particularly when you get into OO Perl).

UPDATE: I have no idea why I wrote function when I meant method...


In reply to Re: AutoLoader - when to use it? by tilly
in thread AutoLoader - when to use it? by kiat

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.