Subject: | Parsing bug in HTML::Template::JIT::Compile |
See attached bug report from Smejkal Petr <Smejkal_Petr@tesco-europe.com>
From Smejkal_Petr@tesco-europe.com Wed Mar 13 13:38:39 2002
Date: Wed, 13 Mar 2002 18:11:29 +0100
From: Smejkal Petr <Smejkal_Petr@tesco-europe.com>
To: sam@tregar.com
Subject: Bug in HTML::Template::JIT::Compile
[ The following text is in the "iso-8859-2" character set. ]
[ Your display is set for the "iso-8859-1" character set. ]
[ Some characters may be displayed incorrectly. ]
Hello,
I've experienced a strange behaviour of your module.
My template:
------------------------------------
<html>
<!-- autor: Petr Smejkal -->
<!-- petr.smejkal@tesco-europe.com -->
<!--
<tmpl_var sql>
-->
------------------------------------
My script:
------------------------------------
use HTML::Template::JIT;
$template = HTML::Template::JIT->new (
jit_debug => 1,
filename => 'test.tmpl',
jit_path => '/intraNet/wwwProjects/tbqt/jit',
);
$template->param( sql => 'asdsad' );
print $template->output;
------------------------------------
Output of the script:
------------------------------------
<html>
<!-- autor: Petr Smejkal -->
<!-- petr.smejkal-europe.com -->
<!--
tmpl_asdsad
-->
------------------------------------
You can see that "@tesco" is missing and "tmpl_" is left over.
It seems that the compiler tried to evaluate @tesco as an array.
I modified the _quote_string function and it works now.
sub _quote_string {
$_[0] =~ s/\\/\\\\/g;
$_[0] =~ s/"/\\\\"/g;
$_[0] =~ s/\r/\\\\r/g;
$_[0] =~ s/\n/\\\\n/g;
$_[0] =~ s/\t/\\\\t/g;
$_[0] =~ s/\@/\\@/g; # <-- this helps
return $_[0];
}
The same situation is with $ and I suppose with % too.
-- Petr Smejkal
-- Business Systems Analyst / Country IT Cz/Sk
-- +420 2 840 14 639