Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chaoticset (2105)

chaoticset
  (email not shown publicly)
http://chaoticset.perlmonk.org/
AOL IM: chaoticset23 (Add Buddy, Send Message)
Yahoo! ID: illuminatus_foil (Add User, Send Message)

JAPH. (That's right -- I'm not Really Inexperienced any more.)

I'm not just here, I'm here [perlmonks.org], and here [javajunkies.org] too, I ramble randomly in my philosophical blog [blogspot.com] and my other blog [blogspot.com]. Soon I'll come in a convenient six-pack.

Journal of chaoticset (2105)

Sunday January 27, 2002
11:38 PM

Frig.

[ #2463 ]
First, I thought I'd posted a journal entry about how I thought I'd posted a journal entry.

Second, I managed to leave two pots of water on the stove and not realize I had done so for over half an hour tonight. Or was it three?

I found out why my script, now that I did my hokey little work around (more on that momentarily), managed to increment the cart to 4 when there were only 2 available on the shelf. I forgot to subtract $got from $want before I updated the cart line.

Okay, hokey work-around time. I found out that what I had been using before,

open("filename.thg", FILE)

won't create nonexisting files. That's why the script was always crashing right after the logo and search box; it was checking for a file, not finding it, and wasn't able to create it.

Clearly, I had somehow been appending to the cart before I was reading the cart, which makes sense in my old transfer model; but in the new one, I have to know how many are in the cart before I can decide where anything's going, so I have to read it first. If it's not there, that presents a problem.

So, in desperation to see the script do something properly again, I just added a call to my cart-appending sub in the cart-reading sub. That's as sloppy as using the mayonnaise knife in the peanut butter jar, but at least I know it's that sloppy now.

Knowing is half the battle, or a third of a muffin, or something, right? So that I can MAKE MONKEYS FAST?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Looks like you could use the filetest operators (described in perldoc -f -X and perlfunc) and a helpful die with $! (see perlvar). You also have the arguments to open backwards, but that could be a transcription error.
    • Funny. I did put those down in reverse, didn't I?

      I actually had a die, I just didn't do it here. The thing was that $! was "No such file or directory" on die, and I had been using the append open mode to create new cart files if they didn't exist. I made the error of calling the file earlier than I previously ever had.

      I got so confused about the open modes that I printed the Camel page it's on, and posted it on the wall next to me. Just called in the wrong order, I think. Once I fix that, the probl

      --

      ------------------------------
      You are what you think.