From: "Rothenmaier, Deane C." <deane.rothenma...@walgreens.com>
> Question one: I've inherited a program (if it matters, the program's
> compiled to an executable, rather than run by the interpreter) that
> uses about a dozen different modules and, picky soul that I am, I'd
> like to list them in alphabetic order rather than all
> higgledy-piggledy as they are now. Is the order in which modules are
> use-ed significant? That is, is there a difference-either at compile
> time or at run-time-between this list: 

> use Win32;
> use Win32::Process;
> use Win32::API;
> use Win32::AdminMisc;
> use Win32::GUI;
> use Win32::TieRegistry;
> use Win32::Service;
> use Win32::Sound;
> use Getopt::Std;
> use File::Copy;
> use File::Content;
> 
> And this list:
> use File::Content;
> use File::Copy;
> use Getopt::Std;
> Use Win32;
> use Win32::API;
> use Win32::AdminMisc;
> use Win32::GUI;
> use Win32::Process;
> use Win32::Service;
> use Win32::Sound;
> use Win32::TieRegistry;

Well. I would not do it. It should not make a difference, but you 
know how is it with the "should"s. Some module may check whether a 
certain other module is loaded, two modules may export a variable or 
subroutine of the same name and the last one wins, ...

use Module::Name;

in Perl does much more than 

 using Namespace.Name;

does in C#.

> Question two: In the code's library list, use Win32::Process appears
> twice. Is this necessary? Is it okay? Is it justifiable?  The code
> works with the double use statement, so I'm guessing it's okay. Just
> wondering if removing the second invocation would be a problem rather
> than a solution. 

No. It's not necessary. That is if the use statement doesn't have any 
additional parameters. 

use Module::Name qw(some things);
...
use Module::Name qw(other things);

might be combined into a single statement, but you definitely cannot 
safely delete the second statement leaving the first intact. If they 
are both without parameters then in general case you are extremely 
unlikely to have problems if you remove the later invocation. In case 
of Win32::Process I did not test it thoroughly, but looking at the 
code I do not see any danger in removing it.

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to