Skip Menu |

This queue is for tickets about the CGI-Ex CPAN distribution.

Report information
The Basics
Id: 27264
Status: resolved
Priority: 0/
Queue: CGI-Ex

People
Owner: Nobody in particular
Requestors: blackbird [...] webbird.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.13
Fixed in: (no value)



Subject: SYNTAX => hte doesn't work under WinXP
Hello. I tried to use the HTML::Template Syntax for my templates by adding sub template_args { return { SYNTAX => 'hte' }; } As a result, all TMPL_VAR markups are gone from the rendered template, without leaving the fillings! (=empty page) I added the following test markups to my template: 1. <!-- TMPL_VAR NAME="CONTENT" --> 2. <TMPL_VAR NAME="CONTENT"> 3. [% CONTENT %] My script has the following hash_swap hook: sub hash_swap { return { CONTENT => 'PAGE ID: ' }; } When removing the template_args hook from the script, [% CONTENT %] is replaced by 'PAGE ID: ' correctly. Using the hook, lines 1 + 2 are removed from the template (=replaced with 'nothing'), while [% CONTENT %] is left untouched, as you would expect. When integrating swap_template as it's suggested in the POD (=loading HTML::Template explicitly), lines 1 + 2 are replaced with 'PAGE ID: ' correctly. Perl Version: v5.8.8 built for MSWin32-x86-multi-thread Platform: osname=MSWin32, osvers=5.0, archname=MSWin32-x86-multi-thread Greetings, Bianka
Subject: Re: [rt.cpan.org #27264] SYNTAX => hte doesn't work under WinXP
Date: Wed, 23 May 2007 10:23:14 -0600
To: bug-CGI-Ex [...] rt.cpan.org
From: Paul Seamons <mail [...] seamons.com>
Show quoted text
> Hello. > > I tried to use the HTML::Template Syntax for my templates by adding > > sub template_args { return { SYNTAX => 'hte' }; } > > As a result, all TMPL_VAR markups are gone from the rendered template, > without leaving the fillings! (=empty page) > > I added the following test markups to my template: > > 1. <!-- TMPL_VAR NAME="CONTENT" --> > 2. <TMPL_VAR NAME="CONTENT"> > 3. [% CONTENT %] > > My script has the following hash_swap hook: > > sub hash_swap { > return { > CONTENT => 'PAGE ID: ' > }; > } > > When removing the template_args hook from the script, [% CONTENT %] is > replaced by 'PAGE ID: ' correctly. Using the hook, lines 1 + 2 are > removed from the template (=replaced with 'nothing'), while [% CONTENT > %] is left untouched, as you would expect. > > When integrating swap_template as it's suggested in the POD (=loading > HTML::Template explicitly), lines 1 + 2 are replaced with 'PAGE ID: ' > correctly. > > Perl Version: v5.8.8 built for MSWin32-x86-multi-thread > Platform: > osname=MSWin32, osvers=5.0, archname=MSWin32-x86-multi-thread
Ahh - interesting. The issue is mine. The cause is that when you use the "output" method, it defaults to CASE_SENSITIVE => 0. Internally when case_sensitive is off, I lower case the matched tags as well as anything input via the "param" method - which is standard HTML::Template procedure. However, when you using SYNTAX - you are passing in parameters via the hash_swap which receives no case lowering. The result is that the template is expecting "content" rather than "CONTENT." The temporary fix for you is to have your template_args look like this: sub template_args { return { SYNTAX => 'hte', CASE_SENSITIVE => 1 }; } The long term fix is I need to set CASE_SENSITIVE to on when using SYNTAX or otherwise calling through the "process" method. I think that it was a terrible default for HTML::Template to employ. Thanks for the report. The next revision will have a suitable fix. Paul
From: blackbird [...] webbird.de
Hello Paul. Show quoted text
> Ahh - interesting. The issue is mine. The cause is that when you use > the "output" method, it defaults to CASE_SENSITIVE => 0. Internally when > case_sensitive is off, I lower case the matched tags as well as anything > input via the "param" method - which is standard HTML::Template procedure. > > However, when you using SYNTAX - you are passing in parameters via the > hash_swap which receives no case lowering. The result is that the
template Show quoted text
> is expecting "content" rather than "CONTENT."
Aah, I see! I tried this either: <!-- TMPL_VAR NAME="content" --> <!-- tmpl_var name="content" --> They both don't work. But I didn't try to use the lower case version in my hash. *cough* However, it now works fine when adding the CASE_SENSITIVE flag. :) Thanks a lot! Greetings, Bianka
Fixed now in version 2.14 or by using Template::Alloy.