[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modperl and fprintf(stdout,...)



Manoj Bist wrote:
> Hi,
> 
> I would really appreciate if someone could answer the following question
> regarding modperl and writing to stdout for me:
> 
> I have a perl binding for a C library which generates binary(audio/video)
> data.  To push this binary data over an HTTP response, fprintf(stdout,...)
> does not work in context of modperl.
> Do I have to copy the binary data to a perl scalar variable and then do
> $r->print(...) in the perl script?

if your binding is in XS you can just use the apache API directly from
your XS module.  something like ap_send_fd() should do the trick if you
have an open fd.  otherwise you'll need to write out buckets in httpd
2.x or use another raw means of streaming the response across the wire.

but to the root of your question, no, you shouldn't need to copy the
data once you have it, provided you work from within XS - use use the
httpd api, for which there are many examples in the httpd distribution
(choose one of the generator modules, like cgi or something).

HTH

--Geoff


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.