In Chapter 12, "Modularize It, Package It, and Send It to the Library!" we first looked into the standard Perl library that was provided with this distribution, Perl 5.6. In that library were a number of .pl and .pm files. The examples covered dealt with packages that did not require knowledge about Perl's use of objects. Those files utilized standard subroutines, not methods. Now that you know how objects and methods are used in Perl, the following examples will demonstrate how to use those modules that require the OOP methodology.
The @INC array contains the pathnames to the libraries Perl will search. After looking at the library listings, we will cd into the standard Perl library and list the files found there. You'll notice that some of the files end with the .pm extension and some end with the .pl extension. The files that utilize objects (ending in .pm) were introduced in Perl 5 and are the modules that support OOP. The files that do not have an extension are the names of directories where Perl has stored modules that fit into that category. For example, the File and Math subdirectories contain modules that pertain to those respective subjects.
The following module, BigFloat.pm, allows the use of floating point numbers of arbitrary length. Number strings have the form /[+-]\d*\.?\d*E[+-]\d+/. When NaN is returned, it means that a non-number was entered as input, that you tried to divide by zero, or that you tried to take the square root of a negative number. BigFloat uses the overload module, which allows Perl's built-in operators to be assigned methods that will cause the operators to behave in a new way. The operator is the key and the method assigned is the value. (See overload.pm in the standard Perl library.)