Hopefully this reply will be seen by a few people.
Thanks everyone for the help. The code cleanup was useful. Randal, since I've use stricted, I used the upload() function instead as you suggested. I also took clscott's code for reference and tried to reproduce it. Still no go however. Allow me to give everyone some more information on my test systems, and then I'll explain what I think is happening.
Test System: WinXP running Apache2, ActiveState Perl 5.8.0 and I use ActiveState's wonderful Komodo 2.5 for coding/debugging.
Server System: not my own, but it's Sun Solaris v.something, with Perl 5.6.1, and Apache2.
Notable behaviours: upload doesn't work on the test system, or on the server system. However, it DOES work when I run the script with Komodo (the CGI environment is emulated at runtime with posts/uploads etc, which work perfectly).
Some background on the script: the HTML form has 3 inputs. A single-line text field, a multi-line text field, and the upload file field. A $var = $q -> param('fieldname'); is never undef if the field is filled (or the file is uploaded). The filehandle (using the upload function) is also defined throughout the script. Here's where things get funny though. I noticed that at some point (with Perl 5.6.1) I was getting "Use of uninitialized value in join or string at (eval 10) line xx" errors (as well as uninitialized variable errors in CGI.pm). My research led me to the conclusion that CGI.pm had a bug in it (fixed since v2.88) where, if Perl were run under taint mode, file uploads wouldn't work. So I installed CGI.pm v2.98 (the latest version), and this time I get no errors, but the script still doesn't work.
There's a pattern though. The script doesn't only fail on the file upload. It also fails on the following:
my $form_accession_number = $q->param('accession');
my $gb_obj = new Bio::DB::GenBank();
$gb_obj = $gb_obj->get_Seq_by_acc($form_accession_number);
my $input_seq = $gb_obj->seq();
$input_seq is undef (though it shouldn't be). By the way, this code snippet works in the debugger. Where the script doesn't fail is on the multi-text field, but I use the value straight off the bat.
My suspicions: I suspect this problem must have something to do with the way Perl or these modules deal with methods. Like before, I'm completely stumped. Someone in another thread for a similar problem suggested using functions as class-methods... would this work??
| [reply] [d/l] |