CHAPTER 10Inside Modules and Packages

We have already seen how modules work from the user's perspective through the do, require, and use statements. We have also seen the relationship between modules and packages. In this chapter, we examine the internals of implementing modules.

In order for modules to be easily reusable, they need to be well behaved. That means not defining variables and subroutines outside their own package unless explicitly asked to do so. It also means not allowing external definitions to be made unless the design of the module permits it. Exporting definitions from one package into another allows them to be used without prefixing the name of the original package, but it also runs the risk of a namespace collision, so both ...

Get Pro Perl now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.