It is terribly difficult to read your post as is, so I didn't. However, I've put together an example of what I think you're after. The first file is the script itself, which uses the A module (A.pm in the local directory). The A module exports a single function, and this module includes the B module which also exports a single function. It in turn uses the C module, which exports a single function, which prints an incoming string.

a_func() takes a single parameter, a string. It passes it to b_func(), which then passes it to c_func() which then prints it to the screen.

The flow is like this:

script -> A::a_func("str") -> B::b_func("str") -> C::c_func("str") # c_func is what prints the data

The script:

use warnings; use strict; use lib '.'; use A qw(a_func); a_func("a string");

The A module:

package A; use lib '.'; use B qw(b_func); # load the 'B' package use Exporter qw(import); our @EXPORT_OK = qw(a_func); sub a_func { my $str = shift; b_func($str); } 1;

The B module:

package B; use lib '.'; use C qw(c_func); use Exporter qw(import); our @EXPORT_OK = qw (b_func); sub b_func { my $str = shift; c_func($str); } 1;

The C module:

package C; use Exporter qw(import); our @EXPORT_OK = qw(c_func); sub c_func { my $string_to_say = shift; print "$string_to_say\n"; } 1;

In reply to Re: Perl Modules by stevieb
in thread Perl Modules by jamroll

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.