The best reason of all to use CGI.pm's functions to access the ENV hash is that if your URL string happens to contain an unusual character, say a percent sign or a caret, then directly parsing the environmental variables will usually break your program. CGI.pm, on the other hand, will seamlessly preserve the unusual character and return it the same way it went in. MS-DOS directory names, for instance, can contain percent signs, so this possibility is not merely theoretical.

Also, I suspect that a clever hacker may be able to engage in misdeeds by submitting unusual input after the '?' or '/'. CGI.pm, which is written by a really brilliant programmer named Lincoln D. Stein, probably screens for at least some types of miscreant CGI input.

For those who are as clueless concerning CGI.pm as I was a few months ago, it is built into current versions of Perl, so there is no need to download or install it.

Hail Lincoln Stein! I do not like to engage in hero worship, because we can all be heroic programmers someday, but this piece of open source work by Mr. Stein is really superb.


In reply to Re: (dkubb) Re: (3) CGI queries without '?' by sierrathedog04
in thread CGI queries without '?' by ryan

Title:
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, details, 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, summary, 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.