Andy Wardley wrote:
Arshavir Grigorian wrote:Thanks for the detailed response, Andy. I am fairly new to TT, so forgive my not being fully aware of all the progress. TT is great (despite any shortcomings), so thank you for a great piece of software.
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
Following, Chad's suggestion I set the COMPILE_DIR and COMPILE_EXT variables and was able to look at the underlying Perl code. Unfortunately, I can't quite pinpoint what is causing the error. The error is being reported on line 63 of the compiled file, which is:
$stash->set('loop', $oldloop);I tried printing out $oldloop, and it was empty. What does this have to do with DateTime::Duration->years()? At this point, I am out of ideas. Is there something I can do to figure out the actual operation performed on my DateTime::Duration object that caused this die? TIA.
Arshavir
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
