[Templates] undefined warnings

Mark Anderson mda@discerning.com
Mon, 06 Oct 2003 23:15:50 -0700


(Ok, now I'm on day 2 with TT, and I've gone so far as reading
some of the documentation....)

Correct me if I'm wrong, but the situation concerning warnings
for undefined variables and methods is kind of dismal :(.

First off, the ttree utility has a --dbg utility, but it just
causes a bit more STDERR output from the program itself.
It has no support for setting DEBUG config in command line.
I fixed that with a small patch:
364d363
<         'template_debug|debug=s',

So then I specify "debug = undef" in my ttree config, and I now
get the benefit of a fatal die with a message like this:
    "  ! undef error - whatever is undefined"

Note that it provides no context information (file and line).
There also appears to be no way to make it just be a warning,
or to make the warning appear in the generated template (vs. console stderr).

I'm kind of surprised by all this.
I consider this as bad as writing perl without "use strict".
Typos are so easy, for example typing things like "[% ELSEIF"
instead of "[% ELSIF".

On a related note, I see no evidence of an available warning
about using "=" instead of "==" in a conditional.
So here too, the "safer" mini-language actually has fewer
diagnostics.

I also see no ability to set a warning for interpolating
non-scalars.

Am I missing something? Is this easy to fix or work around?

-mda