[Catalyst] Variable Catalyst seems to be undefined.

Matt S Trout dbix-class at trout.me.uk
Sat May 10 15:20:41 BST 2008

On Sat, May 10, 2008 at 12:09:21AM +1000, Kieren Diment wrote:
> Catalyst::View::TT uses c.stash.whatever in templates, while  
> Catalyst::View::TTSite uses Catalyst.stash.whatever

Sort of.

the TTSite -helper- generates a Catalyst::View::TT subclass with

  CATALYST_VAR => 'Catalyst',

and whatever that's set to, that's what your variable's gonna be called.
Unless you don't set it at all, in which case it's called 'c'.

Personally I prefer 'ctx', so at some point somebody's probably going to
take my personal opinion as an official best practice[0] yet again and
there'll be a helper that does that as well ;)

More seriously, though - if something goes weird in a component in your
app, please read the documentation for whatever that component does a
'use base' on - it's -usually- going to be enlightening.

[0] If anybody ever finds out who coined the phrase "best practice" please
tell me so I can send them a flaming llama turd as an expression of my
love of it.

      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

More information about the Catalyst mailing list