Subject: | [% tags something %] was translated to [% TAGS something %] directive. |
I found a bug on Template::Parser.
Following code does not work:
--------------------
use strict;
use Template;
my $tt = Template->new({});
$tt->process(\*DATA, { foo => 'foo', tags => '<tags>' }, \my $output);
print $output, "\n";
__DATA__
[% tags | html %]
[% foo %]
--------------------
Because the [% tags | html %] was mistranslated to [% TAGS | html %].
Is this working correct?
I can think it is correct if I turn on the ANYCASE option.
But the "/i" modifier in Template::Parser disturbs to work correct.
Please read and apply the attached patch to Template::Parser.
Subject: | template-parser.patch |
--- Parser.pm.orig Mon Jun 19 16:15:35 2006
+++ Parser.pm Mon Jun 19 16:22:23 2006
@@ -365,6 +365,7 @@
# and now the directive, along with line number information
if (length $dir) {
+ my $tags_directive = $self->{ANYCASE} ? qr<TAGS>i : qr<TAGS>;
# the TAGS directive is a compile-time switch
- if ($dir =~ /^TAGS\s+(.*)/i) {
+ if ($dir =~ /^$tags_directive\s+(.*)/i) {
my @tags = split(/\s+/, $1);
if (scalar @tags > 1) {