Close. You're thinking of something more like Text::ScriptTemplate which compiles to perl code, then executes it.
HTML::Template does "compile" the template, but to an internal data format which it then can save (to disk, shared memory, whatever). Since this phase doesn't look at the passed-in variables, it doesn't know that the if clause is false. It very well could be true next time, and next time we may not even look at the templates because we'll reuse the template that is pre-compiled, all for speed.
And that's the overwhelming idea with HTML::Template - speed. It has many options on caching, just to try to get the right amount of speed from your system.
|