<?xml version="1.0" encoding="windows-1252"?>
<node id="1015845" title="Re: Difference between use Module::Name and use Module::Name qw /method1 method2/" created="2013-01-29 05:44:40" updated="2013-01-29 05:44:40">
<type id="11">
note</type>
<author id="616540">
moritz</author>
<data>
<field name="doctext">
&lt;p&gt;In this specific case, supplying an import list (the &lt;c&gt;qw/is_valid/&lt;/c&gt; part) imports that symbol, leaving it out imports nothing.&lt;/p&gt;

&lt;p&gt;In the general case, the import list is passed to the loaded module's &lt;c&gt;-&gt;import&lt;/c&gt; function, and it can do whatever it wants to do.&lt;/p&gt;

&lt;p&gt;But many, many modules are based on [mod://Exporter]. For Exporter-based modules, not specifying an import list gets you all the symbols listed in the default exportation list called &lt;c&gt;@EXPORT&lt;/c&gt;. Specifying an import list disables that default, and instead gives you the symbols you asked for, if they are listed in &lt;c&gt;@EXPORT_OK&lt;/c&gt;. If they are not, you'll get an error.&lt;/p&gt;

&lt;p&gt;In most cases, importing doesn't affect performance to any discernible degree, but it is often easier for maintenance to list exactly the symbols you want to import. If you have many &lt;c&gt;use&lt;/c&gt; statements, it's easy to search for which module gave you a particular symbol.&lt;/p&gt;

&lt;p&gt;But it is worth mentioning that a few peculiar modules (if I remember correctly, [mod://POSIX] and/or [mod://CGI]) have quite many symbols, and only compile the routines to be exported as requested. In this case, it can make a noticeable difference in start-up time if you import all routines.&lt;/p&gt; 

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-616540"&gt;
[http://perl6.org/|Perl 6 - the future is here, just unevenly distributed]
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1015838</field>
<field name="parent_node">
1015838</field>
</data>
</node>
