Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: CGI.pm: Want your query_string() sorted or unsorted?

by markjugg (Curate)
on Aug 13, 2009 at 11:50 UTC ( #788250=note: print w/replies, xml ) Need Help??


in reply to Re: CGI.pm: Want your query_string() sorted or unsorted?
in thread CGI.pm: Want your query_string() sorted or unsorted?

Thanks. I rarely use "Vars" any more in favor of param(), but I agree it sounds like it could be a good fit here, in combination with a hash comparison function.

<thinks>

I'm recalling that the other piece of wanting this is that the query strings will stored in a database column, and I want them in a canonical form for that, so that two identical queries in a different order will be represented the same.

For that, it sounds like I really do need a "sorted_query_string()" method, which I could supply as a plugin or new method to CGI.pm

Thanks to everyone for the feedback!

  • Comment on Re^2: CGI.pm: Want your query_string() sorted or unsorted?

Replies are listed 'Best First'.
Re^3: CGI.pm: Want your query_string() sorted or unsorted?
by JavaFan (Canon) on Aug 13, 2009 at 11:53 UTC
    I'm recalling that the other piece of wanting this is that the query strings will stored in a database column, and I want them in a canonical form for that, so that two identical queries in a different order will be represented the same.
    That sounds like a database design disaster. Why not store the individual items of the query string as columns?
      Storing query string as a key is useful if you are using a database to reply smartly with HTTP status 301/302/307 (redirect) or 407s (gone) instead of bare 404s (not found).
      In this case, the query string represents a "saved search", and the design has worked fairly well over time. One complication here is that some of the search values have multiple keys. If we were to use Codd's third normal form, we wouldn't have just one row per search, but a whole collection of table rows.

      There are definitely other cases and future cases where I could consider putting each search value it's own database column.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://788250]
help
Chatterbox?
[marto]: clever stuff
[Corion]: marto: Thanks for pointing me to Tinc - I found at least some article that suggests that what I want would be possible with Tinc. Now I can try that out :)
[marto]: I think you can do what you want without too much hassle, but yeah, please try and let me know if it works well :)
[marto]: sadly I've still not remembered the name of that x86 all in one we discussed
[Corion]: marto: Heh - I looked at the Intel things and they were all at EUR 80 or upwards, and that's a bit too much (or rather, for that money, I'd look for a NAS already)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2018-01-17 15:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (201 votes). Check out past polls.

    Notices?