<div class="gmail_quote">On Fri, Apr 29, 2011 at 12:30 PM, Michael Friedman <span dir="ltr"><<a href="mailto:friedman@highwire.stanford.edu">friedman@highwire.stanford.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

At my site, we run a lot of command-line perl scripts. Unfortunately, we also have 2794 perl modules. Some of our scripts load up thousands of lines of perl code before they can do anything, even display a usage statement. Generally, from the time you hit <return> it's at least 5 seconds before anything happens, often longer, because perl has to load in all the required modules.</blockquote>

</div><br>Hm.  Do you actually need these modules loaded?  (I'm guessing not)  One way I've dealt with things like this using, e.g., MooseX::App::Cmd and having a role wrap execute() in each of the command classes, that then calls Class::MOP::load_class() against any modules the command needs to do its thing if the command is told to run.  (MX::App::Cmd is just what I tend to use; the same methodology would work elsewhere.)  This doesn't do any pre-compiling, but helps simply by cutting down to loading only what's needed.<br clear="all">

<br><div>If they're all intertwined and you're looking for a way to make that behavior lazy-load, I'm afraid this won't help you at all.  :)</div><div><br></div><div>                                  -Chris</div>

<div>-- <br>Chris Weyl<br>Ex astris scientia<br>
</div>