I'm not sure I understand your question either, but it sounds like you want to put multiple packages into a single .pm file. You can do this with
package A; # some code here package B; # more code here package C; # and still more code
Save that as Foo.pm and then use Foo; will load packages A, B, and C (and not package Foo, since it's not defined). Packages normally have the same name as the .pm file that contain them and have a one-to-one relationship, but that's by convention (and a very good convention!), not because the language requires it. You can put many packages into a single file or split a single package across many files. But remember that just because you can doesn't necessarily mean you should.

Given the description of what you want to accomplish, you may want to take a look at how the DBI and DBD modules are structured and call each other, since they have a similar design where you just use DBI, then it loads up whichever DBD module(s) it needs behind the scenes without needlessly combining them into a single source file.


In reply to Re: How do I bury some code ? by dsheroh
in thread How do I bury some code ? by rbi

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.