Hello,

I've experienced a strange behavior of JIT-compiled templates.

--------------------- test.pl
use HTML::Template::JIT;
$template = HTML::Template::JIT->new (
  jit_debug => 1,
  filename => 'test.tmpl',
  jit_path => './',
);
$template->param( foo => 'bar' );
print $template->output;

--------------------- test.tmpl
abc $def ghi
<tmpl_var foo>

--------------------- output
abc  ghi
     tbar

--------------------- expected output
abc $def ghi
bar

I'm using:
ActivePerl build 630, 
HTML::Template 2.5
HTML::Template::JIT 0.02
Inline::C 0.43
Windows 2000
VisualStudio 6 SP5

It seems that the string is evaluated as in perl "" but ...

I modified the _quote_string function and now it works fine.
There should be more quoting for @,%, etc.

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];
}

-- Petr Smejkal
-- Business Systems Analyst / Country IT Cz/Sk
-- +420 2 840 14 639

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to