What happens in Case 2?
You must know use CGI qw(:cgi); is equivalent to
BEGIN { require CGI; CGI->import(qw(:cgi)); }

use CGI; is equivalent to

BEGIN { require CGI; CGI->import(); }

So the import method is passed no parameters. It depends on the type of exporter used, if any, what happens then. For example, the standard module Exporter will export the tags/symbols in @EXPORT. Filling @EXPORT is a bad practice for module authors for this reason. CGI loads a lot of unwanted stuff by default, see chapter USING THE FUNCTION-ORIENTED INTERFACE. Hm, turns out CGI doesn't do much by default, I must've been misremembering.

It is a good practice for module consumer to always specify the minimum amount of symbols to import. It saves compile time and memory, and since import can do anything, not only export symbols, it avoid unnecessary side-effects. Most of the time, you simply want an empty list. use CGI qw(); is equivalent to

BEGIN { require CGI; }
Are only the subs loaded that the handle $q references?
No; and you are conflating methods with subroutines.
Is there any documentation that addresses this area?
Follow perldoc -f import
I think this has to do with Autloader and SelfLoader
No.

In reply to Re: What gets loaded by daxim
in thread What gets loaded by SoccerRocks

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.