home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeJava and XSLTSearch this book

4.13. Pod

Pod is a simple, but surprisingly capable, text formatter that uses tags to tell a translator how to format the text. The tags serve several purposes:

  • They tell the formatter how to lay out text on the page.

  • They provide font and cross-reference information.

  • They start and stop parsing of code.

The last item is indicative of one of pod's most useful features—that it can be intermixed with Perl code. While it can be difficult to force yourself to go back and write documentation for your code after the fact, with Perl you can simply intermingle the documentation with the code, and do it all at once. It also lets you use the same text as both code documentation and user documentation.

A pod translator reads a file paragraph by paragraph, ignoring text that isn't pod, and converting it to the proper format. Paragraphs are separated by blank lines (not just by newlines). The various translators recognize three kinds of paragraphs:

Commands begin with =, followed immediately by the command identifier:


They can also be followed by text:

=head2 Second-level head

A blank line signals the end of the command.

A paragraph consisting of a block of text, generally filled and possibly justified, depending on the translator. For example, a command such as =head2 will probably be followed with a text paragraph:

=head2 Pod

Pod is a simple, but surprisingly capable, text formatter that uses
tags to tell a translator how to format the text.
A paragraph that is to be reproduced as is, with no filling or justification. To create a verbatim paragraph, indent each line of text with at least one space:

Don't fill this paragraph. It's supposed 
to look exactly like this on the page.
There are blanks at the beginning of each line.

4.13.1. Paragraph Tags

The following paragraph tags are recognized as valid pod commands.

4.13.3. Pod Utilities

As mentioned earlier, a number of utility programs have been written to convert files from pod to a variety of output formats. Some of the utilities are described here, particularly those that are part of the Perl distribution. Other programs are available on CPAN.


pod2fm [options] file

Translates pod to FrameMaker format.


-book [bookname]
If set, creates FrameMaker book file. If not specified, bookname defaults to perl; filename extension is .book in either case.

Whether to convert a MIF-format .doc output file to binary FrameMaker format. Default is -doc.

-format type
Which format to copy from the template document specified with the -template option. Type can be a comma-separated list, and -format can also be specified more than once. Legal types are:




All types (the default)


Character formats


Paragraph formats


Master page layouts


Reference page layouts


Table formats


Variable definitions


Math definitions


Cross-reference definitions


Color definitions


Conditional text definitions


Preserves page breaks; controls how the other types are used


Preserves other format changes; controls how the other types are used

Whether to generate an index. Defaults to -noindex.

Whether to lock file as read-only so you can use hypertext marker feature. Defaults to -nolock.

Whether to stop execution after generating the MML version of the file. Default is -nommlonly.

Whether to try to open the book after creating it; requires the -book option.

-template document
Specifies a template document for pod2fm copies a format for use in formatting the output. document is the path to the template document.

Whether to generate a table of contents. Defaults to -notoc.

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.