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

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

Hello

I'm sure this is a common perl type task, but I'm not sure what to call the pattern so as to google for it...

I want to use perl to generate WML files from a template, using data from an outside source to fill in tokens in the template, eg: funmail.url.beta, zingy.name.prod... I'm in a situation where I'm maintaining 6 decks or sites in beta and production trim with various subsets of production and verification URLs in each. Right now, when I get a new URL or marketing want to shuffle things, I edit things by hand for beta, get approval for promotion after testing, edit in the production URLs by hand for gamma, test again and copy gamma to production

So that's the set up, what I'm asking is: is there a standard format or package for inserting things appropriate places into templates? I think I've seen something like ${funmail.url.beta}, but I thought I would seek you collective wisdom before I headed off in a random direction.

Thanks,

Jimbus

Never moon a werewolf!

Replies are listed 'Best First'.
Re: generating html from a template
by davidrw (Prior) on Oct 04, 2005 at 21:37 UTC
    Two very popular and common templating modules are Template Toolkit and HTML::Template -- i would start by looking at both of those.. Template Toolkit (tt) is quite powerful, and has a (default) syntax like:
    This is my file. Hello, [% first_name %]. You have [% rows.size %] items: [% FOREACH row = rows %] Name: [% row.name %] ; Color = [% row.color %] [% 'Wow!!!' IF ro +w.color == 'red' %] [% END %]
Re: generating html from a template
by CountZero (Bishop) on Oct 04, 2005 at 21:40 UTC
    Have a look at the various templating packages. I personally like very much Template::Toolkit: I find it very flexible, easy to learn and it has lots of additional extensions.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law