[Catalyst] Making subrequests in views

Alexander Tamm alex at frantic.com
Sun Nov 23 09:29:11 GMT 2008


Hi,

I'm pretty new to Catalyst and new to this mailing list. In other words, 
my apologies if this question has been frequently answered or if I've 
missed the relevant documentation.

My basic setup is a Catalyst application running under FastCGI, using 
View::Mason for my views. I need to include a navigation component in 
most - not all - views, so I'm thinking about what strategy I should use 
to populate the stash with the correct data. As I see it, I have at 
least three options, but I'm not sure how smart they are.

1) I could always populate the stash in auto() and call the 
corresponding Mason component when needed. This means fetching some data 
even if it isn't needed.

2) Calling $c->forward( '/navi' ) in my navi view

3) Using Catalyst::Plugin::Subrequest and doing a subrequest-call from 
the view that needs to include the navi component.

Are these all equeally smart/stupid, or is there a best practice for this?

Thanks in advance,
Alex



More information about the Catalyst mailing list