in reply to Re^2: Can two separate responses be sent to the client's browser from Perl, such as via fork{}?
in thread Can two separate responses be sent to the client's browser from Perl, such as via fork{}?
There are several old postings that may help:
So the PDF file would be created at the same time the log data is created, and I'm not sure how I would get them both from separate requests.
I've just updated an old SANE CGI frontend wrapping scanimage to run on an embedded system. It does something roughly similar: In the scan handler, scanimage emits progress messages that are sent to the browser, while the scanned image is stored in a temp file on the server. The last action of the progress display is to emit a download link (for browsers with Javascript disabled) and a Javascript redirection to that link. The handler for the download link just sends the content of the temp file.
In theory, there should be some code to remove old temp files (e.g. a cron job, a cleanup routine invoked for every request, or simply a call to unlink at the end of the download handler). The CGI should also use individual temp files for each scan. But there is exactly one user for the scanner (me), the CGI frontend is only available in my local network, and I don't care about having an old scan remaining on the scan server, so I use the same temp file for all scans, and I don't even bother to lock the file.
Alexander
|
|---|