Re: combining multiple filtered files into a single response

André Warnier <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Brian wrote:
...
> 
> I'd also like to avoid the last resort which would be to run a long 
> process to process each file, save them to a temporary directory, and 
> then re-read them 
(one after the other)
at the end
(and send them out)
  a single output stream.  This defeats
> the purpose because I'd like to be able to start writing the output of 
> the first filtered file to the client as soon as it's processed.
> 
Why is that "the last resort" ?
It seems to me to be the logical way of achieving what you want.
Anyway, when the user is posting the three files (as 3 "file" boxes in a form), this is 
sent by the browser as one long stream (multi-part encoded, but still one long stream). 
The server is receiving it as one long stream, parsing it, saving each of these files to a 
temporary file on disk, and then handing you a filehandle to each one of them.
Both apreq and CGI will do that for you.
That code is already developed, debugged, optimised, and tested a million times.
Why make your life more complicated than it is, and risk making mistakes re-developing 
your own version of it ?

In addition, you can't really start sending back the result to the client, before this 
client has finished sending the whole form (including all the uploaded files).  The client 
will not even start to read the server response before then.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.