Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Testing Template, or should I write a diff for TT templates?by hardburn (Abbot) |
on Nov 14, 2003 at 17:56 UTC ( [id://307125]=note: print w/replies, xml ) | Need Help?? |
I was actually thinking about this problem this morning (though with regard to HTML::Template, though it should be possible to generalize it to any template system). The problem with keeping two sets of templates (production and debugging) is that a change in the variables sent means you have to update both templates. Ick. Instead, the template module should take a 'debug' option. When activated, the template system will still open the template files and parse them (thus allowing things like HTML::Template's strict mode to work). However, instead of outputing the filled-in template, the system outputs a plaintext version containing the data structure that would otherwise be used to fill-in the template, and is thus easy to parse. Simply dumping with Data::Dumper would be OK (though that would make it harder to parse with anything except Perl). YAML would be a better choice. ---- : () { :|:& };: Note: All code is untested, unless otherwise stated
In Section
Seekers of Perl Wisdom
|
|