Debugging (I Wish I Had Raid)

chaoticset on 2001-10-28T18:21:04

Well, if it were something so simple as just typing it in and watching it work, I wouldn't need to learn how to do it right...right?

I've finally hit a stride of sorts with this: Bring up the page, attempt to access the script, bring up the error log, fix those errors, rinse, and repeat. Time to debug.

Okay...fiddle fiddle fiddle. Realize I wrote the *loop* for this in one place and the code in another; combine and rip out some common elements. Declare one of my stupid variables and run.

A whole series of these pop up:
[Sun Oct 28 12:44:43 2001] [error] [client 63.17.150.189] File does not exist: c:/program files/apache group/apache/htdocs/scripts/root.exe

To which I can only mirror my internal reaction: "HUH?!"

I may not know what caused *those* errors, but I can safely assume something is wrong with what I'm trying to do. Near the end of the ten or so errors is this very understandable line:
[Sun Oct 28 13:03:30 2001] [error] [client 127.0.0.1] Missing $ on loop variable at c:\PROGRA~1\APACHE~1\APACHE\CGI-BIN\CARTER.PL line 111.

I've found that when I fix the errors that make sense, the nonsensical (to me) ones tend to fall away as well. But I didn't write a new loop...!

I found the problem immediately; it was a line or two above. A naked 'for' statement, an aborted thought halfway through my fingers.

Backspace, backspace, backspace. Gone.

Run...and...

Crap. Two pertinent errors stand out on this one:

[Sun Oct 28 13:04:25 2001] [error] [client 127.0.0.1] main::get_cart_name() called too early to check prototype at c:\PROGRA~1\APACHE~1\APACHE\CGI-BIN\CARTER.PL line 93.
[Sun Oct 28 13:04:25 2001] [error] [client 127.0.0.1] Global symbol "$card" requires explicit package name at c:\PROGRA~1\APACHE~1\APACHE\CGI-BIN\CARTER.PL line 132.

Huh. I thought you could put subs anywhere and the script would handle it, but if it says it wants that earlier, I won't argue. I move get_cart_name above where it's called.

Where I had 'my $card', I changed it to 'my $cart', because I *thought* I had weeded out all uses of $card. I was wrong, it seems. Fixed.

Let's see what happens...

...hm. Page hasn't loaded yet. Another friggin' infinity problem.

I'm going to the prompt for this one, since it seems to help with these.

Well, that and I'm going to get some real food. Peanut butter on whole-wheat toast is a nice little fake breakfast, but my body is crying out for at least some ramen. Kitchen time, then prompt this problem out of my life.