A little more on this than others posted might be handy. Do you tend to use the OOP style when calling the class methods in CGI. By that, I mean, do you call them like @p=$query->param() or do you tend to use the imported commands like @p=param()? If you tend to call only the methods by class then you may want to do a use CGI (); to tell perl not to import anything into your space. Sending it an empty list like that is a nice trick if you play the honest OOP game.

OTOH if you like the handy-dandy HTML helpers and like them imported or if you want the code methods imported as well you can get CGI to give you just the ones you want.

Commonly used requests that I've seen are:

## remember, only one. use CGI; # let it do it's own thing. use CGI (); # import NOTHING, thank you. use CGI qw(param redirect); # just param() and redirect() use CGI qw(:cgi); # just cgi stuff use CGI ':html'; # all the HTML[23] and netscape stuff use CGI qw/:html :form/; # all html + form html widgets use CGI ':standard'; # all cgi and HTML[23] and forms use CGI ':all'; # kitchen sink

I tend not to use the qw operator on a single item, but you may get into the habit of doing so if you tend to add things one at a time while building code. Not a bad habit but I personally think it is ugly =)

HTH

--
$you = new YOU;
honk() if $you->love(perl)


In reply to Re: CGI.pm questions... by extremely
in thread CGI.pm questions... by Anonymous Monk

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.