[Catalyst] Problem with RenderView

Jay K jayk at ion0.com
Fri May 4 15:59:46 GMT 2007


Bernhard,

There is no way that I'm aware of to accomplish what you are trying
to do in the manner you are trying to do it.

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.

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.

To make a long story short, your best option is to create your own
View for this streaming data and have your controller tell RenderView
to forward to it, rather than the default view.   Put your $c-
 >response->write()'s inside your view class, rather than inside your
controller.   I recently made a post about how to tell RenderView
what to do - rather than repeat that here, I'll just give you the
link:  http://jayk.vox.com/library/post/picking-a-view.html

Good luck,

Jay



On May 4, 2007, at 9:24 AM, Bernhard Graf wrote:

> On Friday 04 May 2007 15:58, Bogdan Lucaciu wrote:
>> On Friday 04 May 2007 16:53, Bernhard Graf wrote:
>>>> First of all, why are you sending your response from the
>>>> controller and not from the view?
>>>
>>> ???
>>
>> I think you deleted the example.
>
> I think you didn't read my email.
>
> Your example is superfluous, because this is what my application looks
> like basically.
>
> Your answer simply misses the point.
>
> The question is simply:
>
> How to keep RenderView from doing anything, if data has already been
> written using $c->write()?
>
> I also posted a solution to the problem and just want to know if
> a) it is correct or somebody has a better idea and
> b) it could be added to C:A:RenderView in a future release.
>
> --
> Bernhard Graf
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/
> catalyst at lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

---
"Those who can make you believe absurdities can make you commit
atrocities." --Voltaire





More information about the Catalyst mailing list