[Catalyst] modifying the template include_path from the application base

Jason Kohles email at jasonkohles.com
Tue Mar 14 21:50:22 CET 2006


On 3/9/06, marcus baker <marcus.baker at gmail.com> wrote:
> Hi, I'm just dipping into Catalyst for the first time, and having
> trouble modifying the Template Toolkit's INCLUDE_PATH as directed in
> the Tutorial.
>
> My application is named 'Commencement', and my Template Toolkit view
> is implemented through Commencement::View::TToolkit.
>
> I'd like to have my templates accessible via the 'templates' directory
> as per the tutorial.  It works if I place the config directive in
> TToolkit.pm as such:
>
> __PACKAGE__->config( { INCLUDE_PATH => [
> Commencement->path_to('templates') ] } );
>
> However it doesn't work if I try to call config directly from my
> Commencement.pm:
> __PACKAGE__->config({
>     name => 'Commencement',
>     root => __PACKAGE__->path_to('root'),
>     'View::TToolkit' => {
>                          'INCLUDE_PATH' => [ __PACKAGE__->path_to('templates') ]
>                          }
>                      });
>
>
> Is there something obvious I'm missing here?
>
Is your TToolkit.pm in a directory named 'View', or the old-way in a
directory named 'V'?  You have to be consistent, if the file is in
MyApp/V/TToolkit.pm, then the key in your configuration has to be
'V::TToolkit', if the directory is named View, then the key has to be
'View::TToolkit' in order to match it (or at least that's how I
understand the code, there could be some magic somewhere else that I'm
not aware of that is making it consistent.)

Also check on startup to make sure that the 'Loaded components' list
shows your view with a type of 'instance', if it doesn't, then
something made it think the view wasn't a component (although you
shouldn't have this problem if inheriting from Catalyst::View::TT,
I've only seen it when rolling my own views and forgetting to inherit
from Catalyst::Component.)

--
Jason Kohles
email at jasonkohles.com - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire



More information about the Catalyst mailing list