Content deleted Content added
Show examples of both a procedural and object-oriented module. |
m Cite "Programming Perl" as an example of a book written in POD. |
||
Line 3:
Perl is a language allowing many different styles of programming. You're as likely to find a module written in a [[procedural]] style (for example, [http://search.cpan.org/dist/Test-Simple Test-Simple]) as [[object-oriented]] (ex. [http://search.cpan.org/dist/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 ([http://search.cpan.org/dist/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 langauge. 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 [http://www.oreilly.com/catalog/pperl3/colophon.html Programming Perl]. Contrast with [[javadoc]] which is specialized to documenting Java classes. By convention, module documentation typically follows the structure of a Unix man page.
The language of Perl is defined by the single implementation (referred to as "perl") and is added to (and in rare occassions 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.
|