If I am not mistaken, $foo will not stayed shared is a sign that they are using as globals the same thing that you declared to be lexical. That can be fixed by moving the functionality of how you do a call into its own module that doesn't have any lexicals.

But have you trapped the case where they are using the same global variables as each other?

You can fix that, sort of, by wrapping your do in an eval that puts each invocation into a private package. Of course if they use package also, you are out of luck again on the global issue. Likewise if they sometimes refer to variables as being explicitly in package main. Not to mention the joys of global signal handlers.

Please trust me when I say I have the scars and don't recommend that route long-term. Refactoring the code into modules is not that hard, and once done you gain a lot of flexibility.


In reply to Re (tilly) 3: How to call other programs by tilly
in thread How to call other programs by Jonathan

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.