Hi all,
I have problems using the perl cgi hook.
It seems that after I pressed the "send" button my perl script is not called instandly but after the file is uploaded completely.
That might be because of a server setting.
Was anyone faced with this problem before?
Update:
The reason was the pre installed: Apache Security Module
Thanks for your time.
Perl Source Code
#!/usr/bin/perl -w
use CGI::Carp 'fatalsToBrowser';
use CGI qw(:cgi);
use IO::File;
use strict;
my $hook_file = "test.txt";
my $hook_handle = new IO::File;
$hook_handle->open(">> $hook_file") or die("Failed to open $hook_file: $!");
my $hook_query = CGI->new(\&hook, $hook_handle);
#start upload:
my $query = new CGI;
sub hook{
my ($current_filename, $buffer, $bytes_read, $hook_handle) = @_;
$hook_handle->print( join(" ",times()) . " -> " . $bytes_read ."\n" );
}
print "Content-type: text/html\n\n";
1;
To monitor the upload progress I am using tail:
touch test.txt
tail -f test.txt
Using a simple HTML POST form I start to upload a file of 5.5 MB.
The output is always similar:
system time / user time / cpu time -> bytes transfered
0.03 0 0 0 -> 4037
...
...
...
0.11 0.01 0 0 -> 5520894
Saying it uploaded 5.5 MB in 0.1 seconds.
Server configuration
There are tons of differences between the configurations:
use Config qw(myconfig config_sh config_vars);
print myconfig();
print config_sh();
Some differences: (please tell me if sth else could be interessting)
The first value is of the working server.
The second values is of the bugging dreamhost server.
// dreamhost uses an older version of perl:
PERL_API_VERSION='10' -> '8'
api_versionstring='5.10.0' -> '5.8.0'
// dreamhost uses ByteLoader
extensions='B ...'
extensions='B ByteLoader ...'
// dreamhost uses an older gcc version
gccversion='4.3.3' -> '4.1.2 20061115 (prerelease) (Debian 4.1.1-21)'
// dreamhost uses an older libc version
gnulibc_version='2.9' -> '2.3.6'
// the dreamhost server is using fast stdio
usefaststdio='undef' -> 'define'
CGI (updated)
because of Sinans advice I updated my CGI version (however it did not solve my problem)
// dreamhost cgi version
print $query->version (); -> 3.48