Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I have a patch pending for that I'd like peer feedback on. The code change is dead simple, it's the conceptual change itself I'd like feedback on.

Currently, the query_string() method returns $ENV{QUERY_STRING} more or less how it received it, although it always processes and rebuilds the query string internally, so it's possible it's different. One change it will make is to convert the joining character to either "&" or ";", as you prefer.

My patch would cause a further change: it would cause the keys to be returned in a sorted order.

In support this of this change, it "canonicalizes" query strings, so that you can easily compare to queries to see if they have equivalent names and values, even if they are in a different order, or use a different joiner.

Without this change, the comparison would be much harder, you'd have to do something like turning the query back into a hash, then compare two hashes for equality.

On the other hand, you could speak against the change: For one, it's a change that could be considered unnecessary, and somebody, somewhere likely depends on the old behavior.

I tried to find a RFC which spoke to the point, but I couldn't find anything useful.

Although I have already submitted the patch, I'm having second thoughts about how as a "safe" change. There are other alternatives to make query comparison easier, such as a providing a "sorted_query_string()" method that would either directly in, or accessible through a plugin.

What do you think?

In reply to Want your query_string() sorted or unsorted? by markjugg

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    Domain Nodelet?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others meditating upon the Monastery: (3)
    As of 2024-07-23 20:43 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found

      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.