Cosmetic questions: order of module use significant? double

Cosmetic questions: order of module use significant? double

am 19.07.2011 16:20:08 von Deane.Rothenmaier

--===============0470131847==
Content-Type: multipart/alternative;
boundary="_000_115007D93766724DAE9F518846E121DE931AACDMSS8MP 2MBwagreso_"
Content-Language: en-US

--_000_115007D93766724DAE9F518846E121DE931AACDMSS8MP2MBwagre so_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="us-ascii"

Hi, wizards.

I went through my dead-tree library, CPAN, and other places, and found noth=
ing that answers this question, so I'm going to kick it out to the communit=
y...

Question one: I've inherited a program (if it matters, the program's compil=
ed 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 differe=
nce-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;

I know, it's entirely cosmetic, but, as James Cagney said in "The Strawberr=
y Blonde", "that's just the kind of hairpin I am."

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 removin=
g the second invocation would be a problem rather than a solution.

Thanks, O Wise Ones.

Deane Rothenmaier
Programmer/Analyst - IT-StdCfg
Walgreens Corp.
2 Overlook Point #N51022D
MS 6515
Lincolnshire, IL 60069
224-542-5150

Vincit qui patitur. -- Persius


--_000_115007D93766724DAE9F518846E121DE931AACDMSS8MP2MBwagre so_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="us-ascii"

osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">

>





Hi, wizards.


 


I went through my dead-tree library, CPAN, and other=
places, and found nothing that answers this question, so I’m going t=
o kick it out to the community…


 


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 w=
hich modules are use-ed significant? That is, is there a difference—e=
ither 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;


 


I know, it’s entirely cosmetic, but, as James =
Cagney said in “The Strawberry Blonde”, “that’s jus=
t the kind of hairpin I am.”


 


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


 


Thanks, O Wise Ones.


 


Deane Rothenmaier


Programmer/Analyst – IT-StdCfg


Walgreens Corp.


2 Overlook Point #N51022D


MS 6515


Lincolnshire, IL 60069


224-542-5150


 


Vincit qui patitur. -- Persius


 






--_000_115007D93766724DAE9F518846E121DE931AACDMSS8MP2MBwagre so_--


--===============0470131847==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

Re: Cosmetic questions: order of module use significant? double

am 21.07.2011 00:21:27 von Jenda Krynicky

From: "Rothenmaier, Deane C."
> 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
===== Jenda@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