ggvaidya has asked for the wisdom of the Perl Monks concerning the following question:

Fellow monks:

I've got to make two small websites, six to ten pages each. Neither of these webservers support any sort of server-side insertion or scripting. I've got a number of common elements (page header, navigation bar, and so on) which need to be identical across all these pages.

I've been looking for a module which will allow me to "assemble" these pages from source files. I only need two bits of functionality: my individual page files should be able to specify templates to be inserted at the appropriate places, and in specifying these templates, I should be able to pass values to them.

(Since I ended up following the suggestions in the comments, the following description of how I planned to do it is irrelevant. I've wrapped it in <readmore>s that it may trouble us mortals no more).

For example, index.txt might contain:

[:top |title=Welcome to | is blah blah blah :] <p>Welcome to [..]</p>

And top.txt will contain:

[:preamble:] <head> <title>[:$title:]</title> </head> <body>

To my surprise, I can't find a simple module which accomplishes this: there's plenty of template engines, but they're designed for on-the-fly generation of page layouts for dynamic websites, and are largely overkill for my task. I strongly suspect that I can't come up with the right search terms, and that such a module must exist on CPAN somewhere.

Does anybody have any ideas on how to find this module, or am I just going about this task all wrong? I've already started rolling-my-own, with the template format mentioned above, so a module to do this will definitely exist on CPAN in a week or two :-). But I'd hate to end up rewriting somebody else's wheel.

Update Oct 24, 2008: Thanks, everybody! Consensus is, don't roll your own; spending the time figuring out one of the fully-featured template engines will be worth it in the end. The Big Player in this area is the venerable Template::Toolkit, which Your Mother strongly recommended. HTML::Template was pointed to as a simpler, less complicated system, but Your Mother's point - that having learnt Template::Toolkit, you won't need anything else - is a good one.

Update Oct 27, 2008: I tried out WebMake today, and it was exactly what I wanted! Thanks, TGI! I used it to write a new website for; I've also uploaded the source for the entire website. If you're tackling a similar problem to what I describe above, you'll get an idea of what a WebMake file looks like, and what it can do. Available now at the website mentioned above, or (one version ago) at any reputable CPAN mirror. I'm going to try doing another website with Template::Toolkit, and I'll "report back" once that's done.

Once again, thanks to everyone for their help and advice!