|Perl Monk, Perl Meditation|
Comment onby gods
|on Feb 11, 2000 at 00:06 UTC||Need Help??|
In this specific case, supplying an import list (the qw/is_valid/ part) imports that symbol, leaving it out imports nothing.
In the general case, the import list is passed to the loaded module's ->import function, and it can do whatever it wants to do.
But many, many modules are based on Exporter. For Exporter-based modules, not specifying an import list gets you all the symbols listed in the default exportation list called @EXPORT. Specifying an import list disables that default, and instead gives you the symbols you asked for, if they are listed in @EXPORT_OK. If they are not, you'll get an error.
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 use statements, it's easy to search for which module gave you a particular symbol.
But it is worth mentioning that a few peculiar modules (if I remember correctly, POSIX and/or 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.
In reply to Re: Difference between use Module::Name and use Module::Name qw /method1 method2/