1POD2TEXT(1) User Contributed Perl Documentation POD2TEXT(1)
2
3
4
6 pod2text - Convert POD data to formatted ASCII text
7
9 pod2text [-aclostu] [--code] [-e encoding]
10 [--errors=style] [--guesswork=rule[,rule...]]
11 [-i indent] [-q quotes]
12 [--nourls] [--stderr] [-w width] [input [output ...]]
13
14 pod2text -h
15
17 pod2text is a wrapper script around the Pod::Text and its subclasses.
18 It uses them to generate formatted text from POD source. It can
19 optionally use either termcap sequences or ANSI color escape sequences
20 to format the text.
21
22 input is the file to read for POD source (the POD can be embedded in
23 code). If input isn't given, it defaults to "STDIN". output, if
24 given, is the file to which to write the formatted output. If output
25 isn't given, the formatted output is written to "STDOUT". Several POD
26 files can be processed in the same pod2text invocation (saving module
27 load and compile times) by providing multiple pairs of input and output
28 files on the command line.
29
30 By default, the output encoding is the same as the encoding of the
31 input file, or UTF-8 if that encoding is not set (except on EBCDIC
32 systems). See the -e option to explicitly set the output encoding and
33 "Encoding" in Pod::Text for more discussion.
34
36 Each option is annotated with the version of podlators in which that
37 option was added with its current meaning.
38
39 -a, --alt
40 [1.00] Use an alternate output format that, among other things,
41 uses a different heading style and marks "=item" entries with a
42 colon in the left margin.
43
44 --code
45 [1.11] Include any non-POD text from the input file in the output
46 as well. Useful for viewing code documented with POD blocks with
47 the POD rendered and the code left intact.
48
49 -c, --color
50 [1.00] Format the output with ANSI color escape sequences. Using
51 this option requires that Term::ANSIColor be installed on your
52 system.
53
54 -e encoding, --encoding=encoding
55 [5.00] Specifies the encoding of the output. encoding must be an
56 encoding recognized by the Encode module (see Encode::Supported).
57 If the output contains characters that cannot be represented in
58 this encoding, that is an error that will be reported as configured
59 by the "errors" option. If error handling is other than "die", the
60 unrepresentable character will be replaced with the Encode
61 substitution character (normally "?").
62
63 WARNING: The input encoding of the POD source is independent from
64 the output encoding, and setting this option does not affect the
65 interpretation of the POD input. Unless your POD source is US-
66 ASCII, its encoding should be declared with the "=encoding" command
67 in the source, as near to the top of the file as possible. If this
68 is not done, Pod::Simple will will attempt to guess the encoding
69 and may be successful if it's Latin-1 or UTF-8, but it will produce
70 warnings. See perlpod(1) for more information.
71
72 --errors=style
73 [2.5.0] Set the error handling style. "die" says to throw an
74 exception on any POD formatting error. "stderr" says to report
75 errors on standard error, but not to throw an exception. "pod"
76 says to include a POD ERRORS section in the resulting documentation
77 summarizing the errors. "none" ignores POD errors entirely, as
78 much as possible.
79
80 The default is "die".
81
82 --guesswork=rule[,rule...]
83 [5.01] By default, pod2text applies some default formatting rules
84 based on guesswork and regular expressions that are intended to
85 make writing Perl documentation easier and require less explicit
86 markup. These rules may not always be appropriate, particularly
87 for documentation that isn't about Perl. This option allows
88 turning all or some of it off.
89
90 The special rule "all" enables all guesswork. This is also the
91 default for backward compatibility reasons. The special rule
92 "none" disables all guesswork. Otherwise, the value of this option
93 should be a comma-separated list of one or more of the following
94 keywords:
95
96 quoting
97 If no guesswork is enabled, any text enclosed in C<> is
98 surrounded by double quotes in nroff (terminal) output unless
99 the contents are already quoted. When this guesswork is
100 enabled, quote marks will also be suppressed for Perl
101 variables, function names, function calls, numbers, and hex
102 constants.
103
104 Any unknown guesswork name is silently ignored (for potential
105 future compatibility), so be careful about spelling.
106
107 -i indent, --indent=indent
108 [1.00] Set the number of spaces to indent regular text, and the
109 default indentation for "=over" blocks. Defaults to 4 spaces if
110 this option isn't given.
111
112 -h, --help
113 [1.00] Print out usage information and exit.
114
115 -l, --loose
116 [1.00] Print a blank line after a "=head1" heading. Normally, no
117 blank line is printed after "=head1", although one is still printed
118 after "=head2", because this is the expected formatting for manual
119 pages; if you're formatting arbitrary text documents, using this
120 option is recommended.
121
122 -m width, --left-margin=width, --margin=width
123 [1.24] The width of the left margin in spaces. Defaults to 0.
124 This is the margin for all text, including headings, not the amount
125 by which regular text is indented; for the latter, see -i option.
126
127 --nourls
128 [2.5.0] Normally, L<> formatting codes with a URL but anchor text
129 are formatted to show both the anchor text and the URL. In other
130 words:
131
132 L<foo|http://example.com/>
133
134 is formatted as:
135
136 foo <http://example.com/>
137
138 This flag, if given, suppresses the URL when anchor text is given,
139 so this example would be formatted as just "foo". This can produce
140 less cluttered output in cases where the URLs are not particularly
141 important.
142
143 -o, --overstrike
144 [1.06] Format the output with overstrike printing. Bold text is
145 rendered as character, backspace, character. Italics and file
146 names are rendered as underscore, backspace, character. Many
147 pagers, such as less, know how to convert this to bold or
148 underlined text.
149
150 -q quotes, --quotes=quotes
151 [4.00] Sets the quote marks used to surround C<> text to quotes.
152 If quotes is a single character, it is used as both the left and
153 right quote. Otherwise, it is split in half, and the first half of
154 the string is used as the left quote and the second is used as the
155 right quote.
156
157 quotes may also be set to the special value "none", in which case
158 no quote marks are added around C<> text.
159
160 -s, --sentence
161 [1.00] Assume each sentence ends with two spaces and try to
162 preserve that spacing. Without this option, all consecutive
163 whitespace in non-verbatim paragraphs is compressed into a single
164 space.
165
166 --stderr
167 [2.1.3] By default, pod2text dies if any errors are detected in the
168 POD input. If --stderr is given and no --errors flag is present,
169 errors are sent to standard error, but pod2text does not abort.
170 This is equivalent to "--errors=stderr" and is supported for
171 backward compatibility.
172
173 -t, --termcap
174 [1.00] Try to determine the width of the screen and the bold and
175 underline sequences for the terminal from termcap, and use that
176 information in formatting the output. Output will be wrapped at
177 two columns less than the width of your terminal device. Using
178 this option requires that your system have a termcap file somewhere
179 where Term::Cap can find it and requires that your system support
180 termios. With this option, the output of pod2text will contain
181 terminal control sequences for your current terminal type.
182
183 -u, --utf8
184 [2.2.0] Set the output encoding to UTF-8. This is equivalent to
185 "--encoding=UTF-8" and is supported for backward compatibility.
186
187 -w, --width=width, -width
188 [1.00] The column at which to wrap text on the right-hand side.
189 Defaults to 76, unless -t is given, in which case it's two columns
190 less than the width of your terminal device.
191
193 As long as all documents processed result in some output, even if that
194 output includes errata (a "POD ERRORS" section generated with
195 "--errors=pod"), pod2text will exit with status 0. If any of the
196 documents being processed do not result in an output document, pod2text
197 will exit with status 1. If there are syntax errors in a POD document
198 being processed and the error handling style is set to the default of
199 "die", pod2text will abort immediately with exit status 255.
200
202 If pod2text fails with errors, see Pod::Text and Pod::Simple for
203 information about what those errors might mean. Internally, it can
204 also produce the following diagnostics:
205
206 -c (--color) requires Term::ANSIColor be installed
207 (F) -c or --color were given, but Term::ANSIColor could not be
208 loaded.
209
210 Unknown option: %s
211 (F) An unknown command line option was given.
212
213 In addition, other Getopt::Long error messages may result from invalid
214 command-line options.
215
217 COLUMNS
218 If -t is given, pod2text will take the current width of your screen
219 from this environment variable, if available. It overrides
220 terminal width information in TERMCAP.
221
222 TERMCAP
223 If -t is given, pod2text will use the contents of this environment
224 variable if available to determine the correct formatting sequences
225 for your current terminal device.
226
228 Russ Allbery <rra@cpan.org>.
229
231 Copyright 1999-2001, 2004, 2006, 2008, 2010, 2012-2019, 2022 Russ
232 Allbery <rra@cpan.org>
233
234 This program is free software; you may redistribute it and/or modify it
235 under the same terms as Perl itself.
236
238 Encode::Supported, Pod::Text, Pod::Text::Color, Pod::Text::Overstrike,
239 Pod::Text::Termcap, Pod::Simple, perlpod(1)
240
241 The current version of this script is always available from its web
242 site at <https://www.eyrie.org/~eagle/software/podlators/>. It is also
243 part of the Perl core distribution as of 5.6.0.
244
245
246
247perl v5.36.0 2023-01-20 POD2TEXT(1)