Perl Modules


Perl has the capacity to use modules to perform specialized functions. Many modules are included in the standard Perl distribution. The command perldoc perlmodlib documents these modules. In addition, more modules can be downloaded from http://www.cpan.org/.

To see a list of all the available modules on your system, type the following at the command prompt:

 $ find 'perl -e 'print "@INC" ' ' -name '*.pm' -print

The variable @INC contains a list of the directories that perl searches to find modules. Module names end in the extension .pm.

To use functions from a module in your script, include it at the beginning with use, as in

 use Math::Complex;

This module includes support for complex numbers. The file for this module is Math/Complex.pm.

Most modules come with their own documentation. For example, to view the documentation for the module Socket, type the command

 $ perldoc Socket

You may find it easier to consult the documentation on the web at http://perldoc.perl.org/.




UNIX. The Complete Reference
UNIX: The Complete Reference, Second Edition (Complete Reference Series)
ISBN: 0072263369
EAN: 2147483647
Year: 2006
Pages: 316

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net