... that new script is really the more weighty script, basically a full-fledged "program" that I have a hard time thinking of as a merely module.

Do you mean that sometimes this new script is run entirely by itself, without any prior script being run ahead of it? I wasn't expecting this... Based on the initial question, I assumed that you have several scripts that each produce some distinct beginning portion of a page, and the "newscript" provides a common final portion for all those different pages. If that's what you're doing, then it still seems more sensible as a module, regardless of its size.

(On the other hand, if the script really does work on its own without any prior script ahead of it, I'm a little unclear about how you are adapting it to this "secondary" role.)

Do you have some different reason for "chaining" scripts in this way?

Turning a script into a module doesn't need to involve a lot of fuss. Just put in a "package" statement at the top and a "1;" at the end, and instead of printing to STDOUT, have it accumulate text into a return string. Maybe you'll need a little bit of "reorganization" to have a single sub that returns the string (by doing whatever "main" does in the current version).


In reply to Re^3: How to run a Perl script from another script? by graff
in thread How to run a Perl script from another script? by bradcathey

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.