in reply to How do I bury some 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.package A; # some code here package B; # more code here package C; # and still more code
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I bury some code ?
by rbi (Monk) on Aug 31, 2007 at 16:22 UTC |