Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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 ( 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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2021-06-15 09:50 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (69 votes). Check out past polls.