If you have done some profiling and have discovered that load time is really the problem in your case, then there is a simple change that you may be able to employ to speed up load time. Have a look at autouse and/or Class::AutoUse. You can use these to prevent a module from loading until it is actually used in the program.

But this will only help with scripts that run once and exit (ie not mod_perl or PersistentPerl), and will not do anything if these scripts always use some small part of most of the modules (Since they will all need to be loaded anyway). Also, it will obviously only work if load time is really your bottleneck...

Another option would be to look at using PersistentPerl, which will load your script once, and then keep it in memory. This removes the startup cost of the scripts, but does nothing to improve execution time. Also with PersistentPerl you will need to be careful with things like global variables and memory leaks, since the process will have a long life.

- Cees


In reply to Re: Private module organisation by cees
in thread Private module organisation by Smoothhound

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.