in reply to merging multiple name-value pairs (with precedence)

I can't find whether this is documented in the perldoc, but when CGI sees a param that is multi-valued, it appears that the values retain their ordering from the query string. So as long as all your fields are single-valued, you can just join the three query strings (in the order GET, POST, cookie) and pass it to CGI. When you then call param in scalar context, you will get the first appearance of that param in the combined query string.

blokhead

  • Comment on Re: merging multiple name-value pairs (with precedence)

Replies are listed 'Best First'.
Re^2: merging multiple name-value pairs (with precedence)
by EvanK (Chaplain) on Feb 09, 2006 at 22:25 UTC
    ++, that's exactly what i needed to do!

    embarrassing thing is, i read the CGI docs over about 3 times, and just sort of missed that bit about multiple values. anyway, thanks blokhead!

    __________
    Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
    - Terry Pratchett