Is there a CPAN module which implements lazy compilation of modules via the following idea:

1. unshifts a sub ref/object to @INC which when use X is encountered will install an AUTOLOAD stub for package X.

2. The AUTOLOAD stub will 1) remove itself from package X and 2) perform a do on the real path of the module and 3) goto &$AUTOLOAD.

The main purpose would be to avoid loading/compiling a module until when one of its subroutines was actually called. It wouldn't work for all modules (such as meta-programming modules or ones that exported symbols), but it could work for fairly "conventional" modules.

Does anything like that currently exist?


In reply to lazy loading of modules by perl5ever

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.