http://www.perlmonks.org?node_id=719122


in reply to Assembling text into websites

I have done this many times. Template::Toolkit might feel like overkill but this is an area where it totally shines because it can handle variables and configuration and macros between templates and such so well. IIRC the Badger book itself was typeset/assembled with TT2. There are even command line tools bundled to do just this sort of thing. See Template::Tools::ttree and Template::Tools::tpage and the tutorial docs.

An aside: never roll your own template engine. We all seem to and it can be fun but unless you are a super smartie, it will ultimately be just a learning exercise because other super smarties have already done it and have lots of devs providing patches, features, docs, samples, etc. The time invested in learning a heavier toolkit will repay you much more handsomely than trying to build one from scratch.