Hi, bradcathey,
$ 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;
The caller of Main.pm has direct access to show_me() and show_here() using qualified name,
Main::show_here; # since exported by default by Common.pm
Main::show_me; # originally in Main.pm
If the caller has its own use Common then it doesn't have to qualify it, show_here() is enough.
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.
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;
The caller,
use Main;
Main::show_me();
show_here()
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|