|Perl: the Markov chain saw|
mod_perl file upload "end of file found" Or CGI.pm undefined filehandleby Jerzy2012 (Initiate)
|on Nov 28, 2012 at 00:29 UTC||Need Help??|
Jerzy2012 has asked for the
wisdom of the Perl Monks concerning the following question:
Hello fellow Perl coders.
I spent half a day looking for a solution and didn't find a working one. I would appreciate any help.
I am trying to do a simple web based file upload script. It's a part of bigger project so I am using mod_perl (ModPerl::Registry)In my main class named Main.pm I have following code:
In my module File.pm I have:
This gives me:
If I execute it without eval, it throws following code in apache error log file:
[error] End of file found
My HTML form:
I checked it on two browsers(chrome, firefox). I checked this code on two different servers(Debian and CentOS). It doesn't work anywhere.
I tried to use a CGI.pm way of handling files:
And this prints undef to STDERR
The interesting part is that it correctly reads the name of file if I use param method instead of upload. Also during the script execution the file is correctly saved in /var/tmp/CGItemp...I would be extremely grateful for any help.
UPDATEI managed to get this thing working. In Main.pm in method new - first method that is executed at all - I added:
I don't do anything with these objects. I don't pass those anywhere. I can even undef both of those right after declaring it. So my question changes to: Why this works after adding those 2 lines?