in reply to Re^2: Understanding module structure and inheritance
in thread Understanding module structure and inheritance
Hi, bradcathey,
The caller of Main.pm has direct access to show_me() and show_here() using qualified name,$ cat Common.pm package Common; use strict; use warnings; use Exporter; our @ISA = qw(Exporter); # borrows import() our @EXPORT = qw(show_here); sub show_here { } 1; $ cat Main.pm package Common; use strict; use warnings; use Common; sub show_me {} 1;
If the caller has its own use Common then it doesn't have to qualify it, show_here() is enough.Main::show_here; # since exported by default by Common.pm Main::show_me; # originally in Main.pm
However, if you meant that "a way to include Common.pm in Main.pm so Contact.pm can use show_here directly, then make Main.pm to reexport the function.
The caller,package Main; .... use Exporter; use Common; our @ISA = qw(Exporter); # borrows import() our @EXPORT = qw(show_here); # just @Common::Export to export # what ever Common exports. .... sub show_me {} 1;
use Main; Main::show_me(); show_here()
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
In Section
Seekers of Perl Wisdom