Hi Tobias,

Welcome to the mix! You probably noticed the archive URL's in the mailing list signature.

I do some similiar work with huge PDF files, but I haven't really noticed the memory situation. In my instance script, I use $|++ so the output doesn't buffer (or whatever techno-phrase that means ;)) and then for my runmode, I do this:

--------------
my $size = (stat( $file ))[7];
print $query->header(
        -type                   => 'application/pdf',
        -expires                => '+1h',
        -Content_length         => $size
);
open( PDF, "$file" );
while ( read( PDF, my $buffer, 1024 ) ) {
        print $buffer;
}
close ( PDF );
exit;
--------------

That's pretty ugly, as it interrupts cgiapp's flow (w/ that exit() call and printing headers directly), but it works and I believe the memory never goes beyond some limit.

www-data 28403 0.6 0.6 7420 5672 ? S 10:50 0:00 /usr/bin/perl /path/to/instance/script/eQSR.cgi

That was downloading a 3MB PDF and all during the download, those memory #'s (not that I really understand them) never went higher than 7420 and 5672.

I would like to see a more elegant solution, such as your patch and lib idea implemented into cgiapp, as long as the memory situation is taken into consideration and the possibility to provide file specs (size, MIME type, expiration headers, etc).

Cheers,

Jason

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to