1Pod::Text(3pm) Perl Programmers Reference Guide Pod::Text(3pm)
2
3
4
6 Pod::Text - Convert POD data to formatted ASCII text
7
9 use Pod::Text;
10 my $parser = Pod::Text->new (sentence => 0, width => 78);
11
12 # Read POD from STDIN and write to STDOUT.
13 $parser->parse_from_filehandle;
14
15 # Read POD from file.pod and write to file.txt.
16 $parser->parse_from_file ('file.pod', 'file.txt');
17
19 Pod::Text is a module that can convert documentation in the POD format
20 (the preferred language for documenting Perl) into formatted ASCII. It
21 uses no special formatting controls or codes whatsoever, and its output
22 is therefore suitable for nearly any device.
23
24 As a derived class from Pod::Parser, Pod::Text supports the same meth‐
25 ods and interfaces. See Pod::Parser for all the details; briefly, one
26 creates a new parser with "Pod::Text->new()" and then calls either
27 parse_from_filehandle() or parse_from_file().
28
29 new() can take options, in the form of key/value pairs, that control
30 the behavior of the parser. The currently recognized options are:
31
32 alt If set to a true value, selects an alternate output format that,
33 among other things, uses a different heading style and marks
34 "=item" entries with a colon in the left margin. Defaults to
35 false.
36
37 code
38 If set to a true value, the non-POD parts of the input file will be
39 included in the output. Useful for viewing code documented with
40 POD blocks with the POD rendered and the code left intact.
41
42 indent
43 The number of spaces to indent regular text, and the default inden‐
44 tation for "=over" blocks. Defaults to 4.
45
46 loose
47 If set to a true value, a blank line is printed after a "=head1"
48 heading. If set to false (the default), no blank line is printed
49 after "=head1", although one is still printed after "=head2". This
50 is the default because it's the expected formatting for manual
51 pages; if you're formatting arbitrary text documents, setting this
52 to true may result in more pleasing output.
53
54 margin
55 The width of the left margin in spaces. Defaults to 0. This is
56 the margin for all text, including headings, not the amount by
57 which regular text is indented; for the latter, see the indent
58 option. To set the right margin, see the width option.
59
60 quotes
61 Sets the quote marks used to surround C<> text. If the value is a
62 single character, it is used as both the left and right quote; if
63 it is two characters, the first character is used as the left quote
64 and the second as the right quoted; and if it is four characters,
65 the first two are used as the left quote and the second two as the
66 right quote.
67
68 This may also be set to the special value "none", in which case no
69 quote marks are added around C<> text.
70
71 sentence
72 If set to a true value, Pod::Text will assume that each sentence
73 ends in two spaces, and will try to preserve that spacing. If set
74 to false, all consecutive whitespace in non-verbatim paragraphs is
75 compressed into a single space. Defaults to true.
76
77 width
78 The column at which to wrap text on the right-hand side. Defaults
79 to 76.
80
81 The standard Pod::Parser method parse_from_filehandle() takes up to two
82 arguments, the first being the file handle to read POD from and the
83 second being the file handle to write the formatted output to. The
84 first defaults to STDIN if not given, and the second defaults to STD‐
85 OUT. The method parse_from_file() is almost identical, except that its
86 two arguments are the input and output disk files instead. See
87 Pod::Parser for the specific details.
88
90 Bizarre space in item
91 Item called without tag
92 (W) Something has gone wrong in internal "=item" processing. These
93 messages indicate a bug in Pod::Text; you should never see them.
94
95 Can't open %s for reading: %s
96 (F) Pod::Text was invoked via the compatibility mode pod2text()
97 interface and the input file it was given could not be opened.
98
99 Invalid quote specification "%s"
100 (F) The quote specification given (the quotes option to the con‐
101 structor) was invalid. A quote specification must be one, two, or
102 four characters long.
103
104 %s:%d: Unknown command paragraph: %s
105 (W) The POD source contained a non-standard command paragraph
106 (something of the form "=command args") that Pod::Man didn't know
107 about. It was ignored.
108
109 %s:%d: Unknown escape: %s
110 (W) The POD source contained an "E<>" escape that Pod::Text didn't
111 know about.
112
113 %s:%d: Unknown formatting code: %s
114 (W) The POD source contained a non-standard formatting code (some‐
115 thing of the form "X<>") that Pod::Text didn't know about.
116
117 %s:%d: Unmatched =back
118 (W) Pod::Text encountered a "=back" command that didn't correspond
119 to an "=over" command.
120
122 Embedded Ctrl-As (octal 001) in the input will be mapped to spaces on
123 output, due to an internal implementation detail.
124
126 This is a replacement for an earlier Pod::Text module written by Tom
127 Christiansen. It has a revamped interface, since it now uses
128 Pod::Parser, but an interface roughly compatible with the old
129 Pod::Text::pod2text() function is still available. Please change to
130 the new calling convention, though.
131
132 The original Pod::Text contained code to do formatting via termcap
133 sequences, although it wasn't turned on by default and it was problem‐
134 atic to get it to work at all. This rewrite doesn't even try to do
135 that, but a subclass of it does. Look for Pod::Text::Termcap.
136
138 Pod::Parser, Pod::Text::Termcap, pod2text(1)
139
140 The current version of this module is always available from its web
141 site at <http://www.eyrie.org/~eagle/software/podlators/>. It is also
142 part of the Perl core distribution as of 5.6.0.
143
145 Russ Allbery <rra@stanford.edu>, based very heavily on the original
146 Pod::Text by Tom Christiansen <tchrist@mox.perl.com> and its conversion
147 to Pod::Parser by Brad Appleton <bradapp@enteract.com>.
148
150 Copyright 1999, 2000, 2001, 2002 by Russ Allbery <rra@stanford.edu>.
151
152 This program is free software; you may redistribute it and/or modify it
153 under the same terms as Perl itself.
154
155
156
157perl v5.8.8 2001-09-21 Pod::Text(3pm)