3.5. Difference between Namespaces and Modules
-
A namespace or package is a container for
MyPackage::MySubPack::my_func() symbols.
-
A module, on the other hand, is a file that can contain
any number of namespaces, or simply drop everything into the
current namespace (although it shouldn't).
-
It is possible to switch to other packages using the package
statement. However, you then have to remember not to use them,
because Perl will look for a file corresponding to that name.
-
A module can put itself in a completely different namespace than
its designated module name. (e.g: a module loaded with use TheModule;
can declare all of its identifiers in the CompletelyDifferentPackage
namespace.)
-
If this is a bit confusing, then it should be.
Written by Shlomi Fish