Subject: | bug or feature missmatch in Template::Trivial |
Date: | Wed, 18 Mar 2009 19:30:21 +0200 |
To: | bug-Template-Trivial [...] rt.cpan.org |
From: | Коршак Ярослав <yaroslav [...] korshak.name> |
Hi!
I found that code
my $tmpl = new Template::Trivial( templates => '/path/to/templates' )
doesn't work as expected.
It doesn't add required trailing slash in end of template dir.
So if you call
$tmpl->define( main => 'main.tmpl',
list => 'list.tmpl' );
you'll get warning
File '/path/to/templateslist.tmpl' (list) is not a file
File '/path/to/templatesmain.tmpl' (main) is not a file
But using $tmpl->templates( '/path/to/templates' ) is OK.
I think, it can be fixed by replacing 31-33 lines of Trivial.pm
$TMPL_DIR = ( defined $parms{templates}
? $parms{templates}
: '' );
by
templates( $self, $parms{templates} )
if defined $parms{templates};
P.S.:
Also this bug can be used as feature. via new('templates' =>
'/path/to/templates/tmpl_')
it possible to use template files, prefixed by 'tmpl_' or something other ;)
WBR, korshak