[Catalyst] TTSite redefines TT Catalyst Stash Var = C::P::Prototype example breaks

Benjamin R. Ginter bginter at ndevtech.net
Tue Jan 3 12:23:01 CET 2006

After not using Catalyst for a while, I picked it back up this evening but 
was immediately banging my head on getting the define_javascript_functions 
in Catalyst::Plugin::Prototype to actually define them.

Hrm, it says right here: [% c.prototype.define_javascript_functions %] .. 
yep, that's what I have in my template..  I racked my brain, searched the 
archives, searched the wiki, read and reread the docs..wtf.  :)

Finally, I dedid [% USE Dumper %] [% Dumper.dump_html( c ) %] in my 
message.tt2 and realized it was undefined.  Aha!

I had used myapp_create.pl view TT TTSite and that redefines the template 
toolkit 'c' catalyst stash variable as 'Catalyst'.  Maybe it shouldn't do 
this or I should have read that documentation better.

The simplest solution is to comment out the CATALYST_VAR key in 

#    CATALYST_VAR => 'Catalyst',
     INCLUDE_PATH => [ "$root/src", "$root/lib" ],
     PRE_PROCESS  => 'config/main',
     WRAPPER      => 'site/wrapper',
     ERROR        => 'error.tt2',
     TIMER        => 1

Hope this saves someone else some time..


On Wed, 21 Dec 2005, John Wang wrote:

> On 12/21/05, raptor <raptor at tvskat.net> wrote:
>> hi,
>> I'm tring this example :
>> http://www.dev411.com/wiki/AJAX_Select_Chaining_with_Catalyst
>> but no success..
> There were two typos however I'm not sure they affected you since you
> weren't getting any JS. One was in the page.tt template and the other was in
> the controller. The wiki has been fixed and I have it running with those
> changes.
> I didn see any Js-code in the genrated displayForm page ?
>> What have to be installed for AJAX to work ?
> If there's no JS code, you probably need HTML::Prototype and
> Catalyst::Plugin::Prototype. In the page.tt template, [%
> c.prototype.define_javascript_functions %] will insert a lot of JS, however
> TT won't report an error if it can't find c.prototype. In your app you need:
> use Catalyst qw/Prototype/;
> I should probably get rid of the separate Controller in the example....
> HTH,
> John

More information about the Catalyst mailing list