Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Variable Catalyst seems to be undefined.

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


chris at vistaeng

May 9, 2008, 7:01 AM

Post #1 of 5 (273 views)
Permalink
Variable Catalyst seems to be undefined.

TIA for any insight. I am new to Catalyst, using ver. 5.7012. I am working
through JR's examples as well trying to modify them. I found a strange
problem (to me) that I couldn't find any solution for by searching.

Loosely based on Addressbook, it seems that the variable Catalyst in
index.tt2 is not defined. I first noticed this by Catalyst.uri_for('/login')
returning ''.

Does anyone have any pointers on debugging this?


Thanks,
Chris



_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


diment at gmail

May 9, 2008, 7:09 AM

Post #2 of 5 (261 views)
Permalink
Re: Variable Catalyst seems to be undefined. [In reply to]

On 10 May 2008, at 00:01, Chris Devine wrote:

> TIA for any insight. I am new to Catalyst, using ver. 5.7012. I am
> working
> through JR's examples as well trying to modify them. I found a strange
> problem (to me) that I couldn't find any solution for by searching.
>
> Loosely based on Addressbook, it seems that the variable Catalyst in
> index.tt2 is not defined. I first noticed this by Catalyst.uri_for
> ('/login')
> returning ''.
>
> Does anyone have any pointers on debugging this?
>
>

Catalyst::View::TT uses c.stash.whatever in templates, while
Catalyst::View::TTSite uses Catalyst.stash.whatever

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


wdhawes at gmail

May 9, 2008, 7:14 AM

Post #3 of 5 (261 views)
Permalink
Re: Variable Catalyst seems to be undefined. [In reply to]

2008/5/9 Kieren Diment <diment[at]gmail.com>:
>
> On 10 May 2008, at 00:01, Chris Devine wrote:
>
>> TIA for any insight. I am new to Catalyst, using ver. 5.7012. I am working
>> through JR's examples as well trying to modify them. I found a strange
>> problem (to me) that I couldn't find any solution for by searching.
>>
>> Loosely based on Addressbook, it seems that the variable Catalyst in
>> index.tt2 is not defined. I first noticed this by
>> Catalyst.uri_for('/login')
>> returning ''.
>>
>> Does anyone have any pointers on debugging this?

And if in doubt, just use some warn statements or $c->log->debug calls
in your view class, along with Data::Dumper, to see what is being
passed to the template.

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


chisel at herlpacker

May 9, 2008, 7:24 AM

Post #4 of 5 (261 views)
Permalink
Re: Variable Catalyst seems to be undefined. [In reply to]

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

Yeah, I fell for that.

--
Chisel Wright
e: chisel[at]herlpacker.co.uk
w: http://www.herlpacker.co.uk/

I wrote a todo list; Now I can procrastinate more efficiently!

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


dbix-class at trout

May 10, 2008, 7:20 AM

Post #5 of 5 (246 views)
Permalink
Re: Variable Catalyst seems to be undefined. [In reply to]

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

__PACKAGE__->config(
...
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/

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.