[ABE.pm] Here's a weird one

Faber J. Fedor faber at linuxnj.com
Thu Feb 22 16:15:06 PST 2007


I'm working on my report web page, right?  I click on submit and the
cgi-bin executes, generates all kinds of neat-o graphs and displays
them. 

Within that page, I change two variable values and click update.  The
thing crashes.  I track it down to a variable called "table" not being
defined, which is really weird since a line before the crash I say
"define table if it's not defined".

Here's the code:

    my (@labels, $realdate, $enddate);
    my ($Decile1Tag, $Decile10Tag);

    my $q = new CGI;
    
    my $bm = $q->param('bm');
    my $realdate = $q->param('startdate');
    my $enddate = $q->param('enddate');
    my $variable = lc($q->param('variable'));
    my $weighting = lc($q->param('weighting'));
    my $Decile1Tag = $q->param('decile1');
    my $Decile10Tag = $q->param('decile10');
    my $table = $q->param('table');
    
    $Decile1Tag = '1' if ! defined ($Decile1Tag);
    $Decile10Tag = '10' if ! defined ($Decile10Tag);
    $weighting = 'equal' if ! defined($weighting);
    
    my $table = 'fm_'.$bm.'_'.$variable.'_'.$weighting.'_weighting'
        if !defined($table);
    
Anyone see the error?  Both instances of $table have a "my" in front of
it! If I take outthe second my, the CGI program runs on an update as
well as a submit! 

I have been running this code for weeks with this bug.  The compiler
never saw it.  And I just found four more instances of the same bug! All
four can be seen above.

This code compiles and runs from the command line without errors or warnings.

I'm guessing I overloaded the parser/compiler?  This code is a large,
unwieldly steaming POS containing CSS, Javascript, HTML, Dojo and, of
course, Perl in about a thousand lines of code. 

-- 
 
Regards,
 
Faber Fedor
President
Linux New Jersey, Inc.
908-320-0357
800-706-0701

http://www.linuxnj.com





More information about the ABE-pm mailing list