[Catalyst] Problem with RenderView
Bernhard Graf
catalyst2 at augensalat.de
Fri May 4 16:43:44 GMT 2007
On Friday 04 May 2007 17:25, Wade.Stuart at fallon.com wrote:
> Bernhard Graf <catalyst2 at augensalat.de> wrote on 05/04/2007 10:04:30
AM:
> > On Friday 04 May 2007 16:41, Wade.Stuart at fallon.com wrote:
> > > why write()? I thought Cat does this behind the scenes if you
> > > pass $c->res->body($fh); #filehandle
> >
> > There is no filehandle I could easily pass to $c->res->body(),
> > because data comes from a DBIC ResultSet object.
>
> I must be misreading your question then, I read that you store large
> output on disc (I assumed files?) and that you want to write this
> data out in an efficient manor. Are you saying that the actual large
> blobs are stored in the database or does the database store locations
> to these files? If the former, what actual gain do you get by write()
> instead of setting body to a ref (you are already loading the data
> into memory)? If the latter what is wrong with creating a IO fh for
> the file location and passing to body?
Sorry. My description seemed to be a little misleading.
With "stored to disc" I meant the client's disc
(by adding this header your browser shows the "Save to disc" dialogue:
$c->res->header(
'Content-Disposition', qq[attachment; filename="$filename"]
);
)
Basically this is what happens:
$c->stash(result_set => $c->model('Table')); # dl the whole table
$c->forward('MyApp::View::DBIC::CSV');
and the view fetches row by row from $c->stash->{result_set}, formats,
buffers and $c->write()s as soon the buffer has a certain size (16kB).
--
Bernhard Graf
More information about the Catalyst
mailing list