Please forgive me if this is in the documentation somewhere. I have been
unable to find it. Also, please note, although I am not a novice at
Perl, the more interesting uses of file handles, STDOUT, redirection and
such are over my head.

I'm having a problem with a mod_perl app I'm working on. The goal is to
have a mod_perl app that zips up a bunch of files, and sends it to you,
without creating any temporary files (The zips could get huge). I have
it working, but the way I'm doing it, the number of bytes downloaded is
not logged (well, it shows 5 bytes downloaded for a multi megabyte zip).
I understand this, because I'm writing directly to the socket. What I
don't understand is how to work around the problem...

Here's the important segment of my code (Much cut out):

sub handler {
        my $r = shift;

        my $c = $r->connection;
        my $fd = $c->fileno();

        my $io = new IO::Handle;        

        $io->fdopen ( $fd, "w" );
        $io->autoflush(1);
        
        $zip->writeToFileHandle($io, 0);
        $io->close;



I'm using Archive::Zip to zip the files up. It requires a file handle to
write out to (or an actual file, but I don't want any temp files, I want
to create zips on the file, and send them directly to the end user).

The end goal: send the zip file, without using temp files, and log the
size downloaded through normal apache logging (I have custom logging
handler to log the info to a database, but the normal access log is
showing only 5 bytes downloaded too).

Thanks,

- Tripp Donnelly
- Systems Integrator
- BG Telecommunications
- www.BGTelecommunications.com
- [EMAIL PROTECTED]
- (314) 439-0100 ext 28

Reply via email to