On Thu, Oct 22, 2009 at 1:23 AM, Simon Wilcox <[email protected]> wrote:
> > So, it's not a bug in TT per se, i.e. it's not a regression, it's always > been this way but it is a change in behaviour caused by a change > *elsewhere*. The subsequent question is whether TT should change to > suppress the warnings. > > The perl warning seems reasonable to me. It's a code smell to be trying > a numeric comparison on something that's not numeric. > > The Right Thing To Do[tm] is to fix your code so that empty strings are > turned into zeros or something else that makes sense in your application > BEFORE you hand it off to the template for display. > The warnings are important. I find they catch mistakes in templates (or in the stash). Just this week we have new Template coders and the warnings have already been helpful to find mistakes. Interestingly enough, the suppression of the undefined values (foo.bar when foo is undefined) turns out to be a valuable feature in creating clean templates, for example [% IF foo.bar %] is often all that is needed instead of a nested IF foo.defined; IF foo.bar; At one point I tried using DEBUG_UNDEF and coding the templates around the errors. Looked too much like Perl and the templates were unwiedly. -- Bill Moseley [email protected]
_______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates
