Plain Old Documentation

Plain Old Documentation

Plain Old Documentation, abbreviated pod, is a simple
markup language used to document the Perl programming language.

Design

pod is designed to be a simple, clean language with just enough syntax to be useful. It purposefully does not include mechanisms for fonts, images, colors or tables; instead it attempts to be just large enough to be useful. Some of its goals are:
* Easy to parse
* Easy to convert to other languages, such as HTML or TeX
* Easy to incorporate sample code
* Easy to read without a pod formatter (i.e. in its source-code form)
* Easy to write in--otherwise programmers won't write the documentation!

Although the author of [http://www.perldoc.com/perl5.8.0/pod/perlpod.html perlpod] notes that "The Pod format is not necessarily sufficient for writing a book", books have in fact been written in an extended version of pod; this special version included formatting codes for tables and footnotes, and is used by O'Reilly & Associates to produce several Perl books, most notably "Programming Perl" by Larry Wall, Tom Christiansen, and Jon Orwant. A slightly extended,modified version of pod, called mod, was used to write Higher-Order Perl, by Mark Jason Dominus.

Use

pod is the language used for most documentation in the Perl world. This includes Perl itself, nearly all publicly-released modules, many scripts, mostdesign documents, many articles on [http://www.perl.com/ Perl.com] and other Perl-related web sites,and the Parrot virtual machine.

pod is rarely read in the raw, although it is designed to be readable without the assistance of a formatting tool. Instead, it is read with the perldoc tool, or converted into Unix
man pages or Web-standard HTML pages.

Pure pod files usually have the extension .pod, but pod is mostly used directly in Perlcode, which typically uses the .pl and .pm extensions. (The Perl
interpreter's parser is designed to ignore pod in Perl code.) In source code files, the documentation is generally placed after the __END__ marker (which also helps syntax highlighting in some editors to display it as comments).

ample pod document

This document is syntactically correct pod, which attempts to follow the major conventions on section naming as well.

pod formatting details

pod files are written in an ASCII-compatible encoding, such as Latin-1 or Unicode. A pod parser always assumes that the file it is parsing doesn't start with pod; it ignores all linesuntil it sees a pod directive. pod directives must come at the beginning of a line, and all begin with an equal sign. The pod parser will then assume that all following lines are pod, until it encounters a line consisting of the "=cut" directive. Any content following that is ignored until the parser encounters another pod directive. Thus, pod can be intermixed with executable source code if the language's parser knows how to recognize and ignore pod.

pod content is divided into paragraphs by empty lines. Paragraphs that begin with whitespace characters--tabs or spaces--are considered to be "verbatim paragraphs", and are left completely unformatted; these are used for sample code, ASCII art, etc. Paragraphs that begin with an equal sign are "command paragraphs"; the sequence of alphanumeric characters immediately following the equal sign is treated as a pod directive, and the rest of the paragraph is formatted according to that directive. Some directives also affect the following paragraphs. If a paragraph starts with something besides an equal sign or whitespace, it's considered an "ordinary paragraph".

Both ordinary paragraphs and the contents of command paragraphs are parsed for formatting codes. Formatting in pod is very plain; it's mainly limited to bold, italic, underlined, monospaced, and a few other formats. There is also a code for linking between pod documents or to another section within the same document. Formatting codes consist of either:

* A single uppercase letter, followed by a less-than sign (<), the content to be formatted, and a greater-than sign (>), e.g. B, "or"
* A single uppercase letter, two or more less-than signs (<<), a space, the content to be formatted, another space, and the same number of greater-than signs as were used before, e.g. B<< bolded text >>. This form is often used for code snippets containing a greater-than sign, which would otherwise end the formatting code.

Commands in pod include four levels of headings, bulleted and numbered lists, and commands to mark sections as being in another language. The latter feature allows for special formatting to be given to parsers that support it.

See also

* Perl
* Larry Wall
* Sean M. Burke

References

* Wall, Larry; Christiansen, Tom; & Orwant, Jon (2000). "Programming Perl" (3rd ed.). Sebastopol: O'Reilly & Associates. ISBN 0-596-00027-8.

External links

* [http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlpod.pod perlpod (documentation on pod for people writing documents in it)]
* [http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlpodspec.pod perlpodspec (documentation on pod for people writing parsers for it)]
* The Perl manpages in raw pod format can be viewed at [http://search.cpan.org/src/NWCLARK/perl-5.8.8/pod/] .
* The directory [http://search.cpan.org/src/NWCLARK/perl-5.8.7/lib/] contains many modules with embedded pod formatting.
* The [http://search.cpan.org/perldoc?Getopt%3A%3AEuclid Getopt::Euclid module] parses input to a Perl script automatically based on pod tags


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Plain Old Documentation — est un format de documentation, c est le langage de balisage léger utilisé par le langage de programmation Perl. Une version améliorée a été conçue pour Perl 6. POD désigne la version du langage de ce langage de documentation associée à Perl 5… …   Wikipédia en Français

  • Plain Old Documentation — (POD) ist eine vereinfachte Auszeichnungssprache, die 1994 von Larry Wall mit Perl 5 eingeführt wurde, um Dokumentation in den Quelltext von Perl Programmen einzufügen. Inhaltsverzeichnis 1 Eigenschaften von POD 2 Verbreitung 3 …   Deutsch Wikipedia

  • Comparison of documentation generators — The following tables compare general and technical information for a number of documentation generators. Please see the individual products articles for further information. This article is not all inclusive or necessarily up to date. Unless… …   Wikipedia

  • Comment (computer programming) — For comments in Wikipedia markup, see Help:Wiki markup#Character formatting and WP:COMMENT. An illustration of Java source code with prologue comments indicated in red and inline comments in green. Program code is in blue …   Wikipedia

  • Pod — Das englische Wort Pod steht für Halter bzw. Sockel. Siehe Gondel. Die Abkürzung POD hat die folgenden Bedeutungen: Peroxidase, ein Enzym, das Oxidationen mit Hilfe von Peroxiden katalysiert; Pick of Destiny, den englischen Originaltitel des… …   Deutsch Wikipedia

  • Literate programming — is a philosophy of computer programming based on the premise that a computer program should be written similar to literature, with human readability as a primary goal. According to this philosophy, programmers should aim for a ldquo;literate… …   Wikipedia

  • POD — abbr. Plain Old Document (format) abbr. Print / Publishing On Demand Syn: PoD comp. abbr. Piece Of Data comp. abbr. Plain Old Documentation (Perl) comp. abbr. Plain Old Dos comp. abbr. Publishing On Demand acronym Pay On Delivery …   United dictionary of abbreviations and acronyms

  • POD — may refer to: Business * Payable on Death, term used on certain bank accounts or Totten trusts, where payment will be made to a specified person upon the death of the account holder * Proof of delivery, an international commerce term for a signed …   Wikipedia

  • PERL — Paradigmen: prozedural, modular, teilweise objektorientiert Erscheinungsjahr: 1987 Entwickler: Larry Wall, Perl Porter Aktuelle  …   Deutsch Wikipedia

  • Programmiersprache Perl — Perl Paradigmen: prozedural, modular, teilweise objektorientiert Erscheinungsjahr: 1987 Entwickler: Larry Wall, Perl Porter Aktuelle  …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”