[Catalyst] Where to place HTML::Template templates?

Maxim Nechaev nechaev at technodesign.ru
Mon Nov 14 04:08:59 CET 2005


I'am new to Catalyst and just learning it.

I install "Catalyst" and "Catalyst::View::HTML::Template", make MyApp
sceleton and view HTML::Template in it. Then i wrote in MyApp.pm:

#########################################################
sub default : Private
{
    my ($self, $component) = @_;
    $component->stash->{template} = 'start.tmpl';
}

sub end : Private
{
    my ($self, $component) = @_;
    $component->forward('MyApp::View::HTML::Template');
}
#########################################################


Problem. If i understand, by default *.tmpl files searched in
MyApp/root directory. But it is not good, because anybody can view
this template by typing "http://localhost:3000/start.tmpl" in browser.

Question. Where correctly place my templates? Or how correctly set
other path to templates?

Now i solve this by adding in "MyApp::View::HTML::Template":

#########################################################
__PACKAGE__->config
(
    path => '/home/xeim/MyApp/template',
);
#########################################################

But i don't like this solution, from hard coded path in my module.

Thanks.


-- 
Maxim Nechaev




More information about the Catalyst mailing list