perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Dimeler <>
Subject [mp1] CGI upload_hook with PerlRun
Date Tue, 28 Mar 2006 20:24:08 GMT

  I have a file-uploading script from a server running perl scripts as plain old CGI, and
I'm trying 
to port it to an Apache 1.3 server using PerlRun. Everything works except CGI's upload hook.
On the 
vanilla CGI server, the upload hook routine is called repeatedly during the upload process,
under mod_perl, nothing happens until the file is finished uploading, at which point the upload
appears to be called a zillion times in the space of a second or two (based on the logs).

Could anyone shed some light on why this behavior is different under mod_perl, and if there's
a way 
around it?'s docs mention an "Apache UPLOAD_HOOK" feature, but I don't know how I would
about incorporating that in a PerlRun script as it uses Apache::Request objects..

For reference, I'm running:
  Mac OS X Server 10.4.5 with original built-in versions of perl (5.8.6), Apache (1.3.29),
and (3.05)

Snip from the script in question:

use CGI;
my $uploaddir = '/path/to/uploads/';
my $data = {};
my $query = new CGI sub {
	my ($file, $b, $bytes, $d) = @_;
	open my $fh, ">$uploaddir$file.uploadCount";
	$$d{$file} = $bytes;
	print $fh $bytes;
	close $fh
	print STDERR localtime() . ": upload hook called - $file, $bytes\n"
}, $data;
unlink "$uploaddir$_.uploadCount" for keys %$data;
# all file copying, form processing and output goes below here

View raw message