[Catalyst] "Streamed" content delivery?!
Jose Luis Martinez
jlmartinez-lists-catalyst at capside.com
Tue Aug 5 11:48:13 BST 2008
Tomas Doran escribió:
> Have a look at:
> http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Streaming/lib/Streaming.pm
> for a demo solution.
Thanks for the link, I was investigating on "streaming" results too, but
due to an old Catalyst (Debian Etch packages 5.7006), Response does not
support passing an FD to the body method!
So the alternative for people that use Debian Etch packaged Catalyst is to:
my $buffer;
my $bytes = 4096; #Arbitrary 4KB value for chunks. tune on your own.
open my $fh, "what you want to stream" || die "Can't open $!";
binmode $fh;
STREAM:
while ( read( $fh, my $buffer, $bytes ) ) {
last STREAM unless $c->write( $buffer );
}
close $fh;
--
Jose Luis Martinez
jlmartinez at capside.com
More information about the Catalyst
mailing list