Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Perl module
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
[[File:Perl_module.png|thumb|Diagram of the mechanism of using perl modules.]] A '''Perl module''' is a discrete component of [[software]] for the [[Perl]] [[programming language]]. Technically, it is a particular set of [[Convention (norm)|conventions]] for using [[#Perl packages and namespaces|Perl's package mechanism]] that has become universally adopted.{{discuss|Packages and modules}} A module defines its [[source code]] to be in a ''package'' (much like a [[Java package]]), the Perl mechanism for defining [[namespaces]], e.g. ''CGI'' or ''Net::FTP'' or ''XML::Parser''; the file structure mirrors the [[namespace]] structure (e.g. the source code for ''Net::FTP'' is in ''Net/FTP.pm''). Furthermore, a module is the Perl equivalent of the [[class (computer science)|class]] when [[object-oriented programming]] is employed.{{discuss|Packages and modules}} A collection of modules, with accompanying [[Software documentation|documentation]], [[Build automation|build scripts]], and usually a [[test suite]], composes a '''distribution'''. The Perl community has a sizable library of distributions available for search and download via [[CPAN]]. Perl is a language allowing many different styles of programming. A developer is as likely to find a module written in a [[Procedural programming|procedural]] style (for example, [https://metacpan.org/module/Test::Simple Test::Simple]) as [[object-oriented]] (e.g. [https://metacpan.org/module/XML::Parser XML::Parser]), both are considered equally valid according to what the module needs to do. Modules might also be used to [[mixin]] methods ([https://metacpan.org/module/DBIx::Class DBIx::Class]) or be a [[compiler directive|pragma]] ([http://perldoc.perl.org/strict.html strict.pm]) which has an effect immediately upon being loaded. Modules can even be used to alter the syntax of the language. The effect of Perl modules are usually limited to the current [[scope (programming)|scope]] in which it was loaded. It is common for Perl modules to have embedded documentation in Perl's [[Plain Old Documentation]] format. POD imposes little structure on the author. It is flexible enough to be used to write articles, web pages and even entire books such as [https://web.archive.org/web/20070316052422/http://www.oreilly.com/catalog/pperl3/colophon.html Programming Perl]. Contrast with [[javadoc]] which is specialized to documenting [[Java (programming language)|Java]] classes. By convention, module documentation typically follows the structure of a [[Manual page (Unix)|Unix man page]]. The language of Perl is defined by the single implementation (referred to as "perl") and is added to (and in rare occasions taken away from) each new release. For this reason it is important for a module author to be aware what features they're making use of and what the minimum required version of perl is. The code on this page requires perl 5.6.0 which is considered rather old by now.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)