Re: [Templates] Template Toolkit and DateTime::Duration
[prev]
[thread]
[next]
[Date index for 2004/12/08]
Arshavir Grigorian wrote:
> Another problem is that the line numbers are incorrect (8 lines off).
> Line 28 in my template is a line of static HTML. I had to comment out
> everything to figure out the offending line. What's causing this?
It's a rather remarkable feat that you get a line number at all, and only
8 lines off is pretty good. :-)
It wasn't that long ago that TT reported messages like "... at line 1234
of evaluated Perl subroutine" and you had no idea where the error originated
in the source template.
Things are better now, but not perfect. We embed lines in the compiled
template like so:
#line 35 "your/template/source"
If a compile or runtime error does occur, it allows Perl to report a
more useful file/location for the error (the source template, rather than
the generated Perl code). But, like I say, it's not perfect. Sometimes
a single line of template code generates many lines of Perl code. If
Perl yacks on the 4th line of code after the last "#line n" statement,
as shown in the example below, then the compiler reports it as happening at
line n + 4, or specifically, line 14 in this example, when in fact it
happened at line 10.
[% SOME TT CODE %] => #line 10 "my/source/file"
$output .= $blah->de->blah({
etc.
etc.
etc.
# error here
});
I'm in the process of writing the code generators for TT3 and now that
I'm more aware of these issues, I'm being much more careful about generating
code that doesn't screw up the line numbering.
As for the Date::Time error, I have no idea. My best guess is that something
is something in TT is checking that the value is defined and this is falling
back to an overloaded comparison operator that doesn't exist.
Cheers
A
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
 |
Re: [Templates] Template Toolkit and DateTime::Duration
Andy Wardley 08:29 on 08 Dec 2004
|