V
Vito Corleone
Hi,
Sorry if this is newbie question. I am a bit confused about loading
module in another module. Let's say I have a script that look like this.
## script.pl
use strict;
use Module1;
use Module2;
my $m1 = Module1::->new();
print $m1->func1();
my $m2 = Module2::->new(); ## Module2 is also using Module1
print $m2->func2();
## Module2.pm
use strict;
use Module1;
....
The problem is I "use Module1" 2 times, in script.pl and in Module2. I
just wonder is it the right way to do it? Will it takes double memory
(because Module1 is used twice)? Is it better if I only "use Module1" in
script.pl and then pass the reference to Module2 (so I don't need to
"use Module1" in Module2)?
Please enlight me. Thank you in advance.
--Vito
Sorry if this is newbie question. I am a bit confused about loading
module in another module. Let's say I have a script that look like this.
## script.pl
use strict;
use Module1;
use Module2;
my $m1 = Module1::->new();
print $m1->func1();
my $m2 = Module2::->new(); ## Module2 is also using Module1
print $m2->func2();
## Module2.pm
use strict;
use Module1;
....
The problem is I "use Module1" 2 times, in script.pl and in Module2. I
just wonder is it the right way to do it? Will it takes double memory
(because Module1 is used twice)? Is it better if I only "use Module1" in
script.pl and then pass the reference to Module2 (so I don't need to
"use Module1" in Module2)?
Please enlight me. Thank you in advance.
--Vito