Skip Menu |
 

This queue is for tickets about the HTML-Template CPAN distribution.

Report information
The Basics
Id: 32852
Status: rejected
Priority: 0/
Queue: HTML-Template

People
Owner: Nobody in particular
Requestors: rochnyack [...] ngs.ru
Cc:
AdminCc:

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



Subject: TMPL_INCLUDE bug
Date: Fri, 1 Feb 2008 19:39:07 +0600
To: bug-HTML-Template [...] rt.cpan.org
From: "Pavel V. Rochnyack" <rochnyack [...] ngs.ru>
Download (untitled) / with headers
text/plain 1.2k
Hello. HTML::Template template parser has a bug which appears as incorrect search path for files, included by <TMPL_INCLUDE>. I have following templates: template.tmpl common/top.tmpl common/bottom.tmpl Let`s look for my 4 situations. 1. All OK. When I open template.tmpl with content: == cut == <tmpl_include "common/top.tmpl"> <TMPL_IF VAR> <TMPL_VAR VAR> </TMPL_IF> <tmpl_include "bottom.tmpl"> == cut == H:T can find both bottom.tmpl and top.tmpl, and works as expected. 2. When I open template.tmpl with content: == cut == <tmpl_include "common/top.tmpl"> <TMPL_IF VAR><TMPL_VAR VAR></TMPL_IF> <tmpl_include "common/bottom.tmpl"> == cut == H:T can`t find bottom.tmpl, but finds top.tmpl as in 1 test. 1. when I open template.tmpl with content: == cut == <tmpl_include "common/top.tmpl"> <tmpl_include "common/bottom.tmpl"> == cut == H:T can`t find bottom.tmpl, but finds top.tmpl. 2. When I open template.tmpl with content: == cut == <tmpl_include "common/top.tmpl"> <tmpl_include "bottom.tmpl"> == cut == H:T can find both bottom.tmpl and top.tmpl, but it is incorrect behaviour, both files are in same directory. -- Best regards, Pavel mailto:rochnyack@ngs.ru
Download (untitled) / with headers
text/plain 443b
I can't reproduce this problem. Can you please include some code that fails and not just the templates? Maybe it has something to do with the options you're passing to new(). As proof that this can work, I'm attaching a new test file for HTML::Template (that will come out with version 2.10). I've tried lots of different ways to reproduce your problem and I can't. Going to mark this as rejected unless you can provide some code that fails.
Subject: 14-includes.t
Download 14-includes.t
text/x-perl 4.3k
use strict; use warnings; use Test::More tests => 14; use_ok('HTML::Template'); # simple include my $tmpl_string = q|1 2 3 <tmpl_include templates/included2.tmpl> |; my $template = HTML::Template->new_scalar_ref(\$tmpl_string); my $output = $template->output; is(clean($output), '1 2 3 5 5 5', 'simple include'); # nested includes $tmpl_string = q|1 2 3 <tmpl_include templates/included.tmpl> |; $template = HTML::Template->new_scalar_ref(\$tmpl_string); $output = $template->output; is(clean($output), '1 2 3 4 4 4 5 5 5', 'nested includes'); # simple include w/path $tmpl_string = q|1 2 3 <tmpl_include included2.tmpl> |; $template = HTML::Template->new_scalar_ref(\$tmpl_string, path => 'templates'); $output = $template->output; is(clean($output), '1 2 3 5 5 5', 'simple include w/path'); # nested includes w/path $tmpl_string = q|1 2 3 <tmpl_include included.tmpl> |; $template = HTML::Template->new_scalar_ref(\$tmpl_string, path => 'templates'); $output = $template->output; is(clean($output), '1 2 3 4 4 4 5 5 5', 'nested includes w/path'); # multiple same includes $tmpl_string = q|1 2 3 <tmpl_include templates/included2.tmpl> 6 <tmpl_include templates/included2.tmpl>|; $template = HTML::Template->new_scalar_ref(\$tmpl_string); $output = $template->output; is(clean($output), '1 2 3 5 5 5 6 5 5 5', 'multiple same includes'); # multiple different includes $tmpl_string = q|1 2 3 <tmpl_include templates/included2.tmpl> 6 <tmpl_include templates/included3.tmpl>|; $template = HTML::Template->new_scalar_ref(\$tmpl_string); $output = $template->output; is(clean($output), '1 2 3 5 5 5 6 6 6 6', 'multiple different includes'); # multiple different includes w/path $tmpl_string = q|1 2 3 <tmpl_include included2.tmpl> 6 <tmpl_include included3.tmpl>|; $template = HTML::Template->new_scalar_ref(\$tmpl_string, path => 'templates'); $output = $template->output; is(clean($output), '1 2 3 5 5 5 6 6 6 6', 'multiple different includes w/path'); # multiple same nested includes $tmpl_string = q|1 2 3 <tmpl_include templates/included.tmpl> 6 <tmpl_include templates/included.tmpl>|; $template = HTML::Template->new_scalar_ref(\$tmpl_string); $output = $template->output; is(clean($output), '1 2 3 4 4 4 5 5 5 6 4 4 4 5 5 5', 'multiple same nested includes'); # multiple same nested includes w/path $tmpl_string = q|1 2 3 <tmpl_include included.tmpl> 6 <tmpl_include included.tmpl>|; $template = HTML::Template->new_scalar_ref(\$tmpl_string, path => 'templates'); $output = $template->output; is(clean($output), '1 2 3 4 4 4 5 5 5 6 4 4 4 5 5 5', 'multiple same nested includes w/path'); # multiple different nested includes $tmpl_string = q|1 2 3 <tmpl_include templates/included.tmpl> 6 <tmpl_include templates/included2.tmpl>|; $template = HTML::Template->new_scalar_ref(\$tmpl_string); $output = $template->output; is(clean($output), '1 2 3 4 4 4 5 5 5 6 5 5 5', 'multiple different nested includes'); # multiple different nested includes w/path $tmpl_string = q|1 2 3 <tmpl_include included.tmpl> 6 <tmpl_include included2.tmpl>|; $template = HTML::Template->new_scalar_ref(\$tmpl_string, path => 'templates'); $output = $template->output; is(clean($output), '1 2 3 4 4 4 5 5 5 6 5 5 5', 'multiple different nested includes w/path'); # lots of different nested includes $tmpl_string = q|1 2 3 <tmpl_include templates/included.tmpl> 6 <tmpl_include templates/included2.tmpl> 7 <tmpl_include templates/included3.tmpl>|; $template = HTML::Template->new_scalar_ref(\$tmpl_string); $output = $template->output; is(clean($output), '1 2 3 4 4 4 5 5 5 6 5 5 5 7 6 6 6', 'lots of different nested includes'); # lots of different nested includes w/path $tmpl_string = q|1 2 3 <tmpl_include included.tmpl> 6 <tmpl_include included2.tmpl> 7 <tmpl_include included3.tmpl>|; $template = HTML::Template->new_scalar_ref(\$tmpl_string, path => 'templates'); $output = $template->output; is(clean($output), '1 2 3 4 4 4 5 5 5 6 5 5 5 7 6 6 6', 'lots of different nested includes w/path'); sub clean { my $string = shift; $string =~ s/\s+/ /g; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } =head1 NAME t/14-loop-boolean.t =head1 OBJECTIVE Provide a test to show that loops (full or empty) should be able to be used as booleans in a TMPL_IF along with using an empty loop. =cut


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.