Regarding your "Part2" update: I don't quite understand what you are looking for. A template for perl scripts? Why?

Are you looking for a setup like: "Here's a template. Apply it with parameter set 'A' and it will produce perl script 'template_A.pl'; apply it with parameter set 'B' and it will produce perl script 'template_B.pl', ..." ?

That strikes me as being not the best way to capture generalities (or provide a layer of abstraction) across some set of related programming tasks. A properly abstracted solution to a set of related problems would be a single script or module that uses an appropriate set of user-selectable parameters to control its behavior in different contexts, and/or to produce different outputs depending on the user's needs in a given instance.

(Admittedly, "code factory" solutions do have their place, but I don't normally associate those with "templates". Of course, I don't use dynamic code generation all that often, so I'm probably not the best source for advice on that.)

Maybe you should explain your actual goals in a bit more detail?


In reply to Re: Templatize Repeated code by graff
in thread Templatize Repeated code by narainhere

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.