[Catalyst] Can't get view / template to work ?

Tomas Doran bobtfish at bobtfish.net
Tue Oct 30 23:12:17 GMT 2012

On 30 Oct 2012, at 23:06, David Schmidt wrote:

> On 31 October 2012 00:00, Tomas Doran <bobtfish at bobtfish.net> wrote:
>> On 30 Oct 2012, at 16:52, Craig Chant wrote:
>>> I seem stuck with implementing my first view / template.
>>> I have a controller Login.pm
>>> I ran the view helper script ‘create view HTML HTML::template’
>> This can't possibly have worked? You mean create view HTML HTML::Template right?
>>> As per the tutorial I’ve added the following to the config section of MyApp.pm
>>>    TEMPLATE_EXTENSION => '.tp',
>> This needs to be inside the following block
>>>    'View::HTML' => {
>>>            #Set the location for templates files
>>>            INCLUDE_PATH => [
>>>                __PACKAGE__->path_to( 'root', 'src' ),
>>>            ],
>>>        },
> C::M::Tutorial says otherwise
> http://search.cpan.org/~zarquon/Catalyst-Manual-5.9004/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod#Create_a_Catalyst_View

Sorry, but you're wrong.

The tutorial says:

"Edit lib/MyApp/View/HTML.pm and you should see something similar to the following:"

The OP says: "As per the tutorial I’ve added the following to the config section of MyApp.pm"

So, the OP has done something totally different to what the tutorial says, and thus it will behave differently.

If he moves that line to inside the View (as the tutorial suggests), it'll work.

If he moves it to inside the 'View::HTML' block in MyApp.pm, thus namespacing it into the appropriate component, it'll work.

Where it is right now - it will be ignored.


More information about the Catalyst mailing list