Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Bug report: Problems using cache: msg#00014

lang.perl.modules.html-template

Subject: Bug report: Problems using cache

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe