Certain malformed TMPL_VAR tags are parsed oddly
Any tag that looks like this has a weird effect on HTML::Template:
<TMPL_VAR NAME="test"/___>
If the ___ above is replaced by anything other than the empty string, the TMPL_VAR is incorrectly parsed to have the name "test"/ (quotes included). As a result, by default the tag will silently be replaced with nothing (and of course if you provide a parameter named "test"/ it will be substituted as normal).
If a space is included before the /, then the script dies with a syntax error, which I think should be the correct behavior in either case.
Minimal reproduction:
<!-- test.tpl -->
<p><TMPL_VAR NAME="test"/></p>
<p><TMPL_VAR NAME="test"/ ></p>
#!/usr/bin/env perl
# test.pl
use strict;
use warnings;
use HTML::Template;
my $html = HTML::Template->new(filename => 'test.tpl');
$html->param(test => "This is a test file!");
# $html->param('"test"/' => "This isn't right...");
print $html->output;
Expected output:
HTML::Template->new() : Syntax error in <TMPL_*> tag at test.tpl : 2. at /usr/share/perl5/HTML/Template.pm line 2532.
Actual output:
<!-- test.tpl -->
<p>This is a test file!</p>
<p></p>
Output with the commented line uncommented:
<!-- test.tpl -->
<p>This is a test file!</p>
<p>This isn't right...</p>
Patches welcome! Not a lot of active development going on now, but if you fix it and send pull request I'll be happy to merge it.