Autoload can be used for at least one really cool thing. Proxy objects. For instance, if you have a pattern to how you code calls to methods/functions that do db calls, say, selectXXX for selects, insertXXXX for inserts, and you want to track how a particular object/package gets treated, proxy it around an autoloader.

1. Create an autoloader.
2. Regexp against the method name.
3. If the regexp matches, do something.
4. Call the original function.

Another pattern, is if you do any setXXX type things, write it out to the db. Now mind you, this may be quite sub optimial, but there have been instances where it is useful. Such that, if you have a UI, and someone changes the data, you dont' have to have the UI invoke something to save, but the proxy object would save automagically. It, in some ways, make your API a little more user friendly.. but it can and will take a performance hit if not done properly. Write through cache or something may be of use in that instance.

----
Then B.I. said, "Hov' remind yourself nobody built like you, you designed yourself"


In reply to Re: AutoLoader - when to use it? by exussum0
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.