Perl module: Difference between revisions

Content deleted Content added
Rewrote the sample module for better formatting, and included a few explanitory comments.
m Screwed up the link to the article on POD
Line 1:
A '''Perl module''' is a discrete component of software for the [[Perl]] programming language. A module is distinguished by a unique namespace, e.g. "CGI" or "Net::FTP" or "XML::Parser". By conventions, there is typically one module per file with a .pm extension. A collection of one or more modules, with accompanying documentation and build scripts, compose a package. The Perl community has a sizable library of packages available for search and download via [[CPAN]].
 
It is common for Perl modules to have embedded documentation in Perl's [[Plain Old Documentation]]
Documentation|POD]] format. Many modules favor an [[object-oriented]] style, but many are [[procedural]] instead, especially old modules.
 
Below is an example of a very simple object-oriented Perl module and a short program which makes use of the module. It is implemented in a dialect of Perl5 which is compatible with Perl 5.6.0 and higher.