good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Parse template into data structureby Anonymous Monk |
on Nov 07, 2006 at 08:45 UTC ( [id://582589]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: This is likely a trivial question, but I am a novice and the answer eludes me. I am using Template Toolkit to process some ... err, templates. Nothing fancy, just passing a reference to a one dimensional hash, the keys match the template variable names, and it spits out exactly what I expect. So on to some more templates, these provided by a 3rd party. I want to use the templates for my output, but the template variable names no longer match my hash keys. Basically I'm going to be mapping (perhaps not the best word) my hash keys to the 3rd party template variables that are their equivalent. (last_name vs. lname for instance) My question at this time is not related to that particular task, however. My question is.... Does Template Toolkit provide access to the data structure of a parsed template? I already know the names of the keys in my hash, what I want is to be able to fetch out all of the variable names in a simple template and create some logic that can translate my keys to the appropriate template variable. A nudge in the right direction would suffice. I'm quite sure I am overlooking something obvious.
Back to
Seekers of Perl Wisdom
|
|