Hello HTML::Template developers and users, I would like to report a bug regarding cache feature and template objects using the same template file.
Here is the Test-Case: * /opt/Perl/Playground/template.tmp ---------------------------------------------------------------------------- <TMPL_VAR NAME="TITLE"> <TMPL_VAR NAME="CONTENT"> ---------------------------------------------------------------------------- * /opt/Perl/Playground/HtmlTmplHandler.tmpl ---------------------------------------------------------------------------- package Playground::HtmlTmplBugHandler; use warnings; use strict; use Apache2::RequestRec (); use HTML::Template (); my $htmlTemplate = '/opt/Perl/Playground/template.tmpl'; sub handler { my $rRequestRec = shift; my $rTmpl1 = HTML::Template->new(filename => $htmlTemplate, cache => 1); my $rTmpl2 = HTML::Template->new(filename => $htmlTemplate, cache => 1); $rTmpl1->param(TITLE => 'Title'); $rTmpl2->param(TITLE => 'Subtitle', CONTENT => 'Content'); $rTmpl1->param(CONTENT => $rTmpl2->output()); # Invalid. Outputs: # Subtitle # Subtitle # Content =begin comment $rTmpl2->param(TITLE => 'Subtitle', CONTENT => 'Content'); $rTmpl1->param(TITLE => 'Title'); $rTmpl1->param(CONTENT => $rTmpl2->output()); # Invalid. Outputs: # Title # Title # Content =cut =begin comment $rTmpl2->param(TITLE => 'Subtitle', CONTENT => 'Content'); $rTmpl1->param(TITLE => 'Title', CONTENT => $rTmpl2->output()); # Correct. Outputs: # Title # Subtitle # Content =cut $rRequestRec->content_type('text/plain'); $rRequestRec->print($rTmpl1->output()); $rRequestRec->rflush(); return Apache2::Const::OK; } 1; ---------------------------------------------------------------------------- * httpd.conf ---------------------------------------------------------------------------- .. <Location /html_template_bug> SetHandler modperl PerlResponseHandler Playground::HtmlTmplBugHandler </Location> .. ---------------------------------------------------------------------------- My configuration: Apache/2.0.54 (Unix) mod_perl/2.0.1 Perl/v5.8.5 HTML::Template v2.7 It seems that there is a global cache for each template file which apparently temporary holds values as well and it doesn't really expect that two or more instances of the same template might be used in the same time. Can anyone help me with this issue? Thank you in advance. Regards, Jozef -- jozef kosoru http://zyzstar.kosoru.com ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users