it make sense to modify my application so that worker perl scripts are invoked via do() instead of system calls?

Giving bad advice is difficult to avoid if the situation isn't clear, in this case: of what kind are the performance issues? Memory, responsiveness, load of the server?

do file reads a file and executes it. That happens in an unrelated scope with regards to the main script, but that can stomp on global variables or those declared with our, re-define subroutines and whatnot. So all of these 500+ scripts must be revised to check these issues before executing them via do.

Having done that, I would make each script into a file containing just a distinct subroutine, and have them executed via AutoLoader. See POSIX for an example. If memory is an issue, I'd use AutoReloader, keep track of invocation time and memory usage, and periodically unload (via an alarm handler) those scripts (now subroutines) which are seldom used and/or cause the most memory impact.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

In reply to Re: Use of do() to run lots of perl scripts by shmem
in thread Use of do() to run lots of perl scripts by chrestomanci

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.