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)

Friday November 23, 2001
12:21 AM

A Little Coffee

[ #1343 ]
I got lucky. (There are those who believe luck is just the intersection of patience and preparation; who am I to argue with them?)

Some things can only be so f*cked up and do what they're supposed to do.

I was going to attempt an analogy, but it's better to explain. (Especially for myself.)

I had this problem: How do I make a subroutine stop iterating across a list of checkbox values once it's reached the end? As far as I can tell, if there's a checkbox that's not checked, it doesn't return anything that I could look for to indicate that the list is still going but not checked at that point.

I had some funky-ass nested IF and UNTIL statements, trying to check for the existence of something and then for a slapdash 'ending value' I was artificially inserting into each page. I had noted (rightfully!) that I would have to fix it someday, because it was sloppy, but hadn't changed it because there was no better alternative coming to mind.

"Gee," I mused, "wouldn't it be ultra-helpful if I had that checkbox info in a hash, so I could just check keys and all that?" I nodded to myself.

"But how would I fill a hash with the info? What would I set value names to?" Blah, blah, etc., etc., and then something odd occurred to me: I'm *counting* how many times there's a checkbox dumped onto the previous page.

Why not store that in a hidden value?

If it works like I think it will, this will fix the last problem with the cart checker *and* allow me to move up to my security issues, which definately need dealing with.

I got lucky on this one because I was moments away from deciding that I wasn't getting any work done and, therefore, should just go to bed. (I probably should anyway, but the hell with it. I believe it was Erdos who always said that 'there will be time to rest in the grave'.)

I'm going to be so glad to be done with this thing. I honestly found it hard to believe I've been doing this thing for over three months now. It will feel like a little slice of heaven to watch this thing operate; it will make me smile all the time for a week; it will make me want to kiss people.

For now...it just makes me want to be done.

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.
  • If I follow what you mean, here are two things that could come in handy. First, CGI::param() returns a list of the form parameter names, if you pass it no arguments. Combine that with a grep, and you can pick out all parameters that begin with 'card_', for example.

    Of course, if you give the same name to all of the checkboxes in a group, you can call CGI::param() with the name and assign the results to an array. That'll give you all the values.

    Iterating over an array is easy.