I’m looking for suggestions, and I’ll take anything!
I have an html form that lets students check boxes for courses they want to start. it calls a perl script named register.com (on exploringmyself.com). Yes, I’m a high school teacher, not a trained programmer. I often have coding errors that take me a day to figure out, but this one has baffled me for over a week! I’m pretty good at basic perl, but I don’t know beans about Linux or how servers work. Here’s the problem:
I wrote a script that seemed simple to me, but is misbehaving in a way that confuses me. If I check boxes for 5 courses, everything works well and “instantly” — meaning I get a confirmation from the server with a list of courses registered. But if I check 6 or more boxes, the browser hangs and eventually gives up. Meanwhile, the first 5 courses are registered “instantly” then about a minute and a half later the 6th one is registered. Why the delay?
If I am using up a minute and half of server time, that’s HUGE; I’m gonna get in trouble with FutureQuest! But strangely, this only happens to the 6th course — and it doesn’t matter what the 6th course is.
I’ve been a week commenting out sections of code to see what might be hogging time. Unless I’ve blundered (could easily happen), the few offending few lines among the 400+ lines seem to be as follows:
Code:
open my $fh, '<', "$course_file.txt"
or die "could not open $course_file.txt: $!";
while (my $line = <$fh>) {
chomp $line;
my ($key, $value) = split /\t/, $line;
$course_hash{$key} = $value;
}
close $fh;
If there’s a problem here, I don’t see it. All the files I read and write are from 1 to maybe 50K; this is not processor intensive! And more importantly, why the hang on only the 6th course??
I’d like to fix what’s wrong, but I haven’t a clue what it is. What does it mean when a server ignores me for a minute and a half then finishes what it started??
Rick Triplett