Anyway, that's about how I feel right now. Despite the addition of significant amounts of caffeine, natural stimulants, and one lovely glass of home-made hard lemonade, this still isn't making any damn sense.
I've tried to clean up my database calls every which way, and the code is much more compartmentalized now (previously, I was sloppily making database calls in the state subs -- now, each database call is its own sub and gets called, so the state subs kind of read like English). It's prettier and easier to understand.
It works worse.
For whatever reason, the sessions being set look like random numbers grabbed from nowhere. I suspect this is partly due to the evil influence of IE, which has heckled me to no end with caching, pretend form data, etc. to prevent me from knowing what and when I'm screwing up.
(Case in point: If I shut down Apache and fire off a CGI request, IE will continue to load the previous version of resulting HTML. The upshot of this behavior has been that I troubleshot several subs that were working perfectly, except IE wasn't loading them. In its desperation to show me something web-pagey, it showed me the exact wrong thing. That's severely irritating.)
I need, need, need to get this done today. More coffee. More head-pounding. I will get this.