Today I am generating some static HTML pages from a data structure.
HTML::Template makes this a difficult task in many ways.
Not only do I have to jump through hoops both in the HTML and the perl to make it at all possible, I still can't do anything useful.
One thing that is really bugging me is the lack of variables inside the template - I can't create a flag inside the template and check it, this means I can't do something inside and inner loop based on the state of an external loop.
I really hope this place moves to TT soon, as H::T is just plain lame.
It is my understanding that if you create your instance of HTML::Template withOne thing that is really bugging me is the lack of variables inside the template - I can't create a flag inside the template and check it, this means I can't do something inside and inner loop based on the state of an external loop.
then you inner <TMPL_LOOP> can see varibles outside its scope. This won't give you the fuctionality of TT but should make your life a little easier when you want to check flags and such that aren't in your current <TMPL_LOOP>global_vars => 1
However, it sounds to me like you're a lone Perl geek hacking code and hacking templates. For a job like that, TT makes a heck of a lot more sense. Hell, from that perspective even Mason starts making sense.
So, in closing, use the right tool for the job. Then you won't be tempted to slandor that poor wrench you're trying to use as a drill.
-sam
PS: All that said, I've never had an HTML generation problem I couldn't solve with HTML::Template. If you post a full description on PerlMonks you'll be sure to get a solution.
Re:Wrong tool for the job?
TeeJay on 2003-01-28T09:15:46
Then Template Toolkit does H::T's job better.A designers using TT won't need to know any more than a designer using H::T.
But at the same time the same templates can acheive a great deal more without the ridiculous hoop jumping required with H::T.
A designer should not have to worry about many of the problems H::T brings with it. Scoping of variables and other problems make many simple HTML layout tasks hard or impossible.
This is why I think I that H::T is lame - it doesn't even do HTML Templating very well - which is what it claims to do on the tin.
The FAQ and documentation is thin on the ground and essential features are lacking such as template variables, the ability to get keys from hashes and the usability of TT.
I don't mean to slag off the product of somebodies work, but it quite simply doesn't deliver what its advocates or developers claim. The FAQ should give a long list of things that H::T can't do or makes difficult.
Re:Wrong tool for the job?
samtregar on 2003-01-28T15:53:28
Enlighten me then, where should I start in the "long list of things that H::T can't do"? I can't think of a single HTML task I haven't been able to with HTML::Template. I build web applications all day long with HTML::Template and CGI::Application, and nothing has stopped me yet!-sam
Re:Wrong tool for the job?
TeeJay on 2003-01-29T11:05:45
ok try looping through N lists concurrently, or looping through the keys of a hash, or using an iterator object, or keeping track of presentation logic values with variables local to the template.You can do anything with H::T assuming you totally mangle your data and code to squeeze everything into an array of hashes.