Chapter 5
Chapter 5
On Modules and Objects
A package enables a programmer or a group of coordinating programmers to demarcate fortified boundaries around portions of the code. The use of packages enables organization of code into small partitions that can be used to achieve a complex task. If the program under construction is large and a team of developers is involved, the use of packages allows the project manager to break up the code into parts that can be developed by independent groups or individuals. The interface among the constituent components must be agreed upon and stated with precision.
In general, there can be several packages in a file. When a file contains only one package, and some simple naming conventions are obeyed, we get a module. Modular programming enables portions of code developed for one project to be reused in other projects. Finally, using packages and references (discussed in Section 3.3), one can write object-oriented programs in Perl. We discuss each of these three topics in this chapter.
