Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

After thinking again about your code, I have one question and one additional remark. Please note that C and assembler is my main business, so I am usually using the sort of Perl syntax which is similar to C, and I might have misunderstood what you are doing in your code. Anyways:

delete $cgi->{param}{keywords} if length && !/[&=]/;

Do I get this right: The "keywords" parameter is deleted if the length of the query string is >0 and the query string does not contain = or &? The code would then fail when the script would be called without any query string (which was the situation where I was surprised by the problem the first time). If I am right, we should write

delete $cgi->{param}{keywords} if (!defined || !length || !/[&=]/;

instead. Correct?

One more problem / remark: Suppose the script is called via

/cgi-bin/ then would generate a parameter "keywords=Test", and we would remove that parameter accordingly. But that would be only the half of the way: I think that "Test" in that case should be a KEY in the parameter list which has an empty (or undefined) value. How exactly should we handle this? What is the difference between the following calls (from the viewpoint of the CGI specification)?

/cgi-bin/ /cgi-bin/ /cgi-bin/ /cgi-bin/

Of course, I'd test myself before boring others, but I am not sure if it would be a good idea to find out by using or Plack, because I now have learned that (at least) does unexpected things, so I could not use that for testing. Not sure about Plack, though.



In reply to Re^2: Unwanted parameter when executing CGI scripts by Nocturnus
in thread [SOLVED] Unwanted parameter when executing CGI scripts by Nocturnus

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
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (7)
    As of 2018-05-25 10:11 GMT
    Find Nodes?
      Voting Booth?