Okay - I was wrong. I do NOT have the add-inventory tool finished. I have it NEARLY finished; now I just have to add the hard part. :(
See, I was so happy that it was appending new inventory properly, I forgot what anybody else reading this journal would have remembered: "It's got to be able to add the inventory correctly if there's some in the file already!"
I forgot.
Good news, though: I examined the problem, and, figuring that inventory is only going to be updated every-so-often, decided to make a second pass through the inventory file.
(I ended up typing this into the comments in the source; I include it here for completeness' sake)Y'know, Salmon Rushdie wrote a story once entitled _As Rare As Rubies_, which was tied into the quote in the story: "Pieces of wise advice are as rare as rubies." It comes to mind that perfect solutions are like that; rare as rubies. An imperfect, but easier, solution has come to me. Append the entries as normal and *make a second pass over the file*. Time isn't a worry in this program or in the invoice_maker, because they're being run with an entire computer instead of a virtual Web computer (that is, the connection between the two machines creating a virtual machine that has poorly linked components). Ergo, two passes into the inventory file, one of them being as short as the append will usually be, isn't a terrible idea.
It could be fairly short, too; just has to find lines with duplicate product names, add their numbers, and delete the duplicate line. A little razzle dazzle to an experienced programmer.
And just a few hours work for me.
Ideally, I'll work on the CGI algorithm right after that. I don't have any time to work on this project tomorrow, mostly because if I don't pass my classes this semester I'm out of school, but that's okay; I'll get it done tonight, grab three or four solid hours of sleep, and assuming I zip through my homework like I always seem to, I'll *find* time tomorrow. Worst case scenario, I get back to it Monday after giving it time to simmer.
I can't wait.