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??


In reply to Re: Re: A trivial CGI.pm problem... by cyphedude
in thread A trivial CGI.pm problem... by cyphedude

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.