I am SO happy.
The stocker script appears to be doing *everything* it needs to do. :)
I finally have all the data worked out. Format this, format that. It reads bare Cl**ster and the new inventory file's format, and spits out what it's supposed to. A little minor tinker and it'll be alpha-runnin'. :)
Wow, wow, wow.
Had an argument with my mother tonight about my brother, the insanely well paid one who has no real ability other than brownnosing. I explained very patiently that I want to have a legacy; I want someone to be able to point at what I've done in my life and say, "See this? He did that." Because my brother is going to die someday - but I will not. A little piece of me will live on in the things I have coded and the things I have written. There will be nothing of him; he doesn't understand himself, much less the world that operates him.
Yeah, I know. I'm not there yet. I remind myself of that every day - that this is the beginning, that the end is far off, and that the progresses I find amazing now will be insignificant compared to what I will do someday. I'm not there yet.
But I will be.
Oh, and there's actually a reason for this entry, too. :\ Sorry to wax philosophical. It's to remind myself.
Where was I?
CGI. Oh, right, that. Well, now that I've got operational stock files and I can create them whenever the hell I feel like it, the CGI is the next step. I need to rework the code I have.
I should point this out while I'm thinking of it: When I sat down and made myself rewrite the code, it came out much cleaner. I don't know if this is good Perl - I doubt it - but it's fairly easy for me to understand when I read it.(I couldn't get the code tags to work, so I just BRed the whole mess. In case you try to read it, it's an excerpt; this part reads in lines of new inventory, ignored)
print DEBUG "Start of New Inventory builder.\n";
my $i = 0;
while () {
# First, let's get rid of the first line, the trash line...
if ($i == 0) {
$i++;
} else {
# This part should ONLY happen the second line and every line after.
chomp;
s/( ){8}//;
s/( )/=/;
($stock, $name) = (split(/=/));
# print DEBUG "$name, $stock\n";
# The next line is a cheap trick where an elegant solution should go.
# If the first character of the card name is a nonword character,
# the next line replaces it with Ae. This is to handle that weird
# AE character. I realize it's cheap. It's also all I have right now.
$name =~ s/^\W/Ae/;
# The next regex changes any single comma with a single space into just
# a space. This is to match some errors in the Cl**ster list; I should
# clean this up in the future. (Make it so it matches properly but keeps
# the proper name in the stock file.)
$name =~ s/, / /;
$new{$name} = $stock;
}
}
print DEBUG "End of New Inventory builder.\n";
I'm thinking of redoing the CGI this way. It makes me think it may be MUCH cleaner if I do it. :\ What daunts me (...they were dauntless. "Who the hell needs daunts?" was a common thing to hear then...) is the length of that wretched script. It looks like crap, it *is* crap, and I honestly don't want to have to go through crap again.
Pay now or pay later, I guess.
I'll at least make an attempt to clean up the existing; if it looks like changes would be as much work as rewriting it, I'll rewrite it.
I'm so happy to be programming tonight! I didn't think I'd have the energy. Well, two liters of Mountain Dew plus a few cups of strong-ass coffee will do that to you. :)