[Catalyst] Beginner question: View directory

Kieren Diment diment at gmail.com
Thu Nov 8 05:25:17 GMT 2007


On 8 Nov 2007, at 16:16, Dave Rolsky wrote:

> On Thu, 8 Nov 2007, Kieren Diment wrote:
>
>> TT.pm is the file that contains the programming logic for  
>> rendering your view.  You can do stuff like set http headers,  
>> automatically add stuff to the stash/session/whatever and co in  
>> here.  It inherits from Catalyst::View::TT
>
> The View subclass for your app is _not_ the place to do those  
> things. They should be done in your controllers. I can imagine  
> doing some header setting in the view, primarily the content type,  
> but I would imagine most other headers are better off being set in  
> the controller.
>

Good call, my mistake.  Goes to show that there's not usually much  
(or any) extra stuff that needs to be done in the View class.  I was  
actually struggling to think of code related things  (rather than  
config) which  you might want to put in there.   Personally I've  
always munged headers in the sub end : ActionClass(’RenderView’) {}  
subs (see perldoc Catalyst::Action::RenderView for details).


More information about the Catalyst mailing list