Content deleted Content added
→top: Added image and caption #suggestededit-add-image-top Tags: Mobile edit Mobile app edit Android app edit |
m Disambiguating links to Object-orientation (link changed to Object-oriented programming) using DisamAssist. |
||
(One intermediate revision by one other user not shown) | |||
Line 6:
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 programming|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]].
Line 30:
<syntaxhighlight lang="perl">
#!/usr/bin/env perl
# Loads the module and imports any functions into our namespace
# (defaults to "main") exported by the module. Hello::World exports
Line 145:
====''hello_world.pl''====
<syntaxhighlight lang="perl">
#!/usr/bin/env perl
use Hello::World;
|