[Catalyst] Problem with RenderView

Bernhard Graf catalyst2 at augensalat.de
Fri May 4 11:34:01 GMT 2007


For a Catalyst application I have written View classes that serialize 
DBIC ResultSets to common formats (CSV, XML) to be stored to disc.

Since the amount of data can become really big, the views don't set 
$c->response->body(), but write the data directly in chunks using 
$c->write().

The problem now is, that because $c->response->body() remains empty 
C:A:RenderView still thinks it has to forward to the default view.
As a result the Catalyst error page is appended to the (CSV/XML) output
(Couldn't render template "file error - admin/data/dump: not found").

To come around this I use MyAction('RenderView') now, that
<cite>
return 1 if $c->response->{_finalized_headers};
</cite>
because finalize_headers() is called at the first call to $c->write().

Any problems with this approach (besides that it access' an internal 
variable of Catalyst::Response)?

Could this be included in a future release of C:A:RenderView?
-- 
Bernhard Graf



More information about the Catalyst mailing list