B.1. Library Terminology

Before we list all the standard modules, let's untangle some terminology:

Package

A package is a simple namespace management device, allowing two different parts of a Perl program to have a (different) variable named $fred. These namespaces are managed with the package declaration, described in Chapter 5 of Programming Perl.

Library

A library is a set of subroutines for a particular purpose. Often the library declares itself a separate package so that related variables and subroutines can be kept together, and so that they won't interfere with other variables in your program. Generally, an old-style library was placed in a separate file, often with a name ending in ".pl". The library routines were then pulled into the main program via the require function. More recently this older approach has been replaced by the use of modules (see next paragraph), and the term library often refers to the entire system of modules that come with Perl.

Module

A module is a library that conforms to specific conventions, allowing the library routines to be brought into your program with the use directive at compile-time. Module filenames end in ".pm", because the use directive insists on that. Chapter 5 of Programming Perl describes Perl modules in greater detail.

Pragma

A pragma is a module that affects the compilation phase of your program as well as the execution phase. Think of it as containing hints to the compiler. Unlike other modules, pragmas often (but not always) ...

Get Learning Perl, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.