[Catalyst] Problem with RenderView

Bernhard Graf catalyst2 at augensalat.de
Fri May 4 16:24:14 GMT 2007


On Friday 04 May 2007 16:59, Jay K wrote:

> RenderView basically forwards processing to your view object.   It
> has some 'outs' to avoid doing that when it is inappropriate,
> as in when body is filled out or you are redirecting, etc.  But there
> is no 'just don't do it' flag.

That's why I added this "don't do anything if finalize_headers() has 
already been executed behaviour".

> What Bogdan was trying to tell you is that while, yes, your code does
> do the write, doing it inside your controller is somewhat against the
> MVC method generally used in Catalyst.   Which means, essentially,
> that you are going to run into problems with the modules because they
> all expect MVC behavior.

And what I'm telling since the first message in this thread is, that I 
have View classes, that $c->write() instead of $c->response->body().

> link:  http://jayk.vox.com/library/post/picking-a-view.html

Bingo! I wasn't aware of this "current_view" variable.

So instead of $c->forward('MyApp::View::DBIC::CSV') I now say
$c->stash(current_view => 'MyApp::View::DBIC::CSV') and can go with the 
current Catalyst::Action::RenderView.

Thank you very much.
-- 
Bernhard Graf



More information about the Catalyst mailing list