Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

generating html from a template

by jimbus (Friar)
on Oct 04, 2005 at 21:29 UTC ( #497413=perlquestion: print w/ replies, xml ) Need Help??
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!

Comment on generating html from a template
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://497413]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (15)
As of 2014-10-20 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (85 votes), past polls