[Catalyst] How to send raw HTTP response
J. Shirley
jshirley at gmail.com
Thu Sep 25 21:10:56 BST 2008
On Thu, Sep 25, 2008 at 11:35 AM, Christian Lackas <christian at lackas.net> wrote:
> Hi Everybody,
>
> is it possible for a controller method to directly produce the raw HTTP response?
> My application generates a (potentially large)) ZIP file on the fly,
> which I don't want to store (on disk or in memory) but rather send it
> directly to the client while producing it.
>
> In a CGI script I use Archive::Zip such as
>
> print CGI::header(...);
> $ZIP->writeToFileHandle(*STDOUT);
> for my $f (@files) {
> $ZIP->addFile($f, basename($f));
> }
>
> How can I achieve something similar under Catalyst?
>
> Thanks,
> Christian
>
You can use IO::Scalar, then pass that to $c->res->body... that's what
I do for XLS reports and it works fine, but they're not that large and
it doesn't do incremental writes.
-J
More information about the Catalyst
mailing list