in reply to CGI.pm and QUERY_STRING

First CGI.pm and CGI::Simple *do* maintain the supplied order of params when you iterate over the list so the simple answer is yes.

However you can't depend on the order the params are passed in, there are/used to be some browser quirks. Next you can just get the original (or whatever is in your current object) query string using the query_string() method in CGI.pm. Your sample code is broken as CGI.pm will URL decode the param keys/values and if you want a valid query string you need to URL encode the keys and values again (as noted there is a method to handle all the details for you) Finally any app that depends on the supplied order is at best fragile, if not actually broken.

cheers

tachyon

Replies are listed 'Best First'.
Re: CGI.pm and QUERY_STRING
by powerhouse (Friar) on Apr 07, 2004 at 03:50 UTC
    I just need it to use with LWP, which the site that is posting the data to me, wants me to post it back, exactly as they sent it... and add a command to the end of the query so it knows it's validating the info.

    I guess I could just stick with their "sample" code, although it does use the old methods.

    thx,
    Richard
      Why not just do your test on the params and then send them back:
      get("http://their.domain/script?". $ENV{QUERY_STRING}. "&my_param=whatever");

      ?

      cLive ;-)