in reply to Templatize Repeated code

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?

Replies are listed 'Best First'.
Re^2: Templatize Repeated code
by Anonymous Monk on Oct 18, 2007 at 18:55 UTC
    I am also looking for an example on how we can templatize the repetitive code of perl scripts. A sample example can be great. Thanks!