Thomas Owens Thomas Owens - 2 years ago 96
Perl Question

In Perl, how do I put multiple packages in a single .pm file?

I'm pretty sure that I read somewhere that it's possible, but there are a few gotchas that you need to be aware of. Unfortunately, I can't find the tutorial or page that described what you need to do. I looked through the Perl tutorials, and didn't find the one that I remember reading. Could someone point me to a page or document that describes how to put multiple packages into a single .pm file?

Answer Source

You simply start off the new package with another package statement:

package PackageOne;

# ...... code

package PackageTwo;

# .... more code

Problems with this approach

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download