Esteemed and venerable monks, (hey, groveling never hurt!)
I have a problem. I have a number of classes that work wonderfully if I copy and paste:
package foo;
sub new
{
...
}
sub someOtherFunction
{
...
}
package bar;
sub new
{
...
}
sub someOtherFunction
{
...
}
package baz;
sub new
{
...
}
sub someOtherFunction
{
...
}
But for the life of me, I can't get these classes working in a module; I can only get them working in an application using them directly (i.e. copy and paste into each perl script that needs them).
I've tried everything I know, and I'm feeling strangely ignorant.
I've tried putting them into a series of .pm files in a hierarchy and using
use test::foo;
use test::bar;
use test::baz;
Which not only seems terribly wasteful, it doesn't solve the problem.
Is it possible to declare and use more than one public class in a module? If so, how on earth does one do it?
In other words: How do I set up foo, bar, and baz to be classes in the same namespace??
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.