On Jan 9, 2008 2:59 PM, David Martin <[EMAIL PROTECTED]> wrote:
> Hello,
>
>
>
> I have a template with an error in it that I just can't seem to track
> down. I seem to recall from years ago that there is a way to tell the TT
> compiler to compile the template file and in that way discover the line
> number where it breaks?
>
>
>
> Is there a way to do that?
>
> You mean like this:
my $tt = Template->new();
$tt->process('template.tt') || die $tt->error();
I tested with the following in template.tt:
[% template.name %]
[% IF foo %]
and it gave me:
> perl foo.pl
file error - parse error - template.tt line 2: unexpected end of input
You can call the parser directly, using the text of the template, like this:
use Template::Parser;
use Data::Dumper;
use File::Slurp;
my $tt_code = File::Slurp::read_file('./template.tt');
my $parser = Template::Parser->new();
my $perl_code = $parser->parse($tt_code);
die $parser->error() unless defined $perl_code;
print Dumper $perl_code;
but it will just give you the same error.
>
>
> Thanks for any help,
>
>
>
> David Martin
> NolaFlash.com <http://www.nolaflash.com/>
> Web Design, Programming and Hosting
>
> 4600 S Tonti St
> NO LA 70125
> 504.583.3755
>
> <http://www.nolaflash.com/>
>
>
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
>
>
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates