ArticleslgStudy

science

Plain Old Documentation

Plain Old Documentation is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Plain Old Documentation rather than just read about it. In short: Plain Old Documentation (pod) is a lightweight markup language used to document the Perl programming language, modules, and programs. Design Pod is designed to be a simple, clean language with just enough syntax to be useful.

Key takeaways

  • Plain Old Documentation belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Plain Old Documentation to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Plain Old Documentation from memory before moving on to harder problems.

Reference excerpt

Plain Old Documentation (pod) is a lightweight markup language used to document the Perl programming language, modules, and programs.

Design Pod is designed to be a simple, clean language with just enough syntax to be useful. It purposely omits mechanisms for fonts, images, colors, or tables. Some of its goals are:

Easy to parse Easy to convert to other formats, such as XML, TeX, or Markdown Easy to incorporate sample code Easy to read without a pod formatter (i.e., in its source-code form) Easy to write An extended version of pod that supports tables and footnotes called PseudoPOD has been used by O'Reilly & Associates to produce several Perl books, most notably Programming Perl by Larry Wall, Tom Christiansen, and Jon Orwant. Pod makes it easy to write manual pages, which are well suited to user-oriented documents. In contrast, other documentation systems, such as Python's Docstring or Java's Javadoc, though they can be used for user documentation, are designed to facilitate generating developer-oriented documentation about the source code for a software project.

Use Pod is the language used for most documentation in the Perl world. This includes Perl itself, nearly all publicly released modules, many scripts, most design documents, many articles on 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. It is also possible to use pod in other contexts than Perl. For example, to add simple documentation to bash scripts, which can then be easily converted to man pages. Such uses rely on language-specific hacks to hide the pod part(s), such as (in bash) prefixing the POD section with the line :<<=cut which works by calling bash's no-op : command, with the whole block of Pod as a here document as input to it. Pure pod files usually have the extension .pod, but pod is mostly used directly in Perl code, which usually use 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). Pod can easily be converted to other formats, for example some of the various Wiki formats like: WikiWikiWeb, Kwiki, TWiki, UseModWiki, TiddlyWiki, Textile, MediaWiki, MoinMoin or Confluence using Pod::Simple::Wiki.

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

=head1 NAME

My::Module - An example module

=head1 SYNOPSIS

use My::Module; my $object = My::Module->new(); print $object->as_string;

=head1 DESCRIPTION

This module does not really exist, it was made for the sole purpose of demonstrating how POD works.

=head2 Methods

=over 12

=item C<new>

Returns a new My::Module object.

=item C<as_string>

Returns a stringified representation of the object. This is mainly for debugging purposes.

=back

=head1 LICENSE

This is released under the Artistic License. See L<perlartistic>.

=head1 AUTHOR

Juerd - L<http://juerd.nl/>

=head1 SEE ALSO

L<perlpod>, L<perlpodspec>

=cut

Formatting details Pod files are written in an ASCII-compatible encoding, such as Latin-1 or UTF-8. A pod parser always assumes that the file it is parsing doesn't start with pod; it ignores all lines until it sees a pod directive. This must be at a line start and all begin with an equal sign. The pod parser then assumes 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 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. A code exists to link between pod documents or to another section within the same document. Formatting codes consist of either:

One uppercase letter, followed by a less-than sign (<), the content to be formatted, and a greater-than sign (>), e.g., B<bolded text>, or One 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 will 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 last feature allows special formatting to be given to parsers supporting it.

See also Comparison of documentation generators

References Wall, Larry; Christiansen, Tom; & Orwant, Jon (2000). Programming Perl (3rd ed.). Sebastopol: O'Reilly & Associates. ISBN 0-596-00027-8. Chapter 15, "Working with Pod", in foy, brian d (2007). Mastering Perl. Sebastopol: O'Reilly Media. ISBN 0-596-52724-1. Section 5.2, "Embedding Documentation in Shell Scripts", in Albing, Carl; Vossen, JP; & Cameron Newham. (2007). bash Cookbook: Solutions and Examples for bash Users; O'Reilly & Associates. ISBN 0-596-52678-4.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Plain Old Documentation

Start with the simplest possible case. Write down what Plain Old Documentation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Plain Old Documentation before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Plain Old Documentation ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Plain Old Documentation

In research
Plain Old Documentation appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Plain Old Documentation in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Plain Old Documentation is common in secondary-school and first-year university syllabi. It links to neighbouring topics Lightweight markup languages, Perl, Source code documentation formats, so understanding it makes those chapters shorter.
In everyday life
Look for Plain Old Documentation outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Plain Old Documentation” →

How to study Plain Old Documentation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Plain Old Documentation means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Plain Old Documentation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Plain Old Documentation in simple terms?

Plain Old Documentation (pod) is a lightweight markup language used to document the Perl programming language, modules, and programs. Design Pod is designed to be a simple, clean language with just enough syntax to be useful.

Why does Plain Old Documentation matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Plain Old Documentation?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Plain Old Documentation.

Tags

  • Lightweight markup languages
  • Perl
  • Source code documentation formats

Keep exploring