1Pod::Text(3)          User Contributed Perl Documentation         Pod::Text(3)
2
3
4

NAME

6       Pod::Text - Convert POD data to formatted text
7

SYNOPSIS

9           use Pod::Text;
10           my $parser = Pod::Text->new (sentence => 1, 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

DESCRIPTION

19       Pod::Text is a module that can convert documentation in the POD format
20       (the preferred language for documenting Perl) into formatted text.  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::Simple, Pod::Text supports the same
25       methods and interfaces.  See Pod::Simple for all the details; briefly,
26       one creates a new parser with "Pod::Text->new()" and then normally
27       calls parse_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       errors
43           How to report errors.  "die" says to throw an exception on any POD
44           formatting error.  "stderr" says to report errors on standard
45           error, but not to throw an exception.  "pod" says to include a POD
46           ERRORS section in the resulting documentation summarizing the
47           errors.  "none" ignores POD errors entirely, as much as possible.
48
49           The default is "pod".
50
51       indent
52           The number of spaces to indent regular text, and the default
53           indentation for "=over" blocks.  Defaults to 4.
54
55       loose
56           If set to a true value, a blank line is printed after a "=head1"
57           heading.  If set to false (the default), no blank line is printed
58           after "=head1", although one is still printed after "=head2".  This
59           is the default because it's the expected formatting for manual
60           pages; if you're formatting arbitrary text documents, setting this
61           to true may result in more pleasing output.
62
63       margin
64           The width of the left margin in spaces.  Defaults to 0.  This is
65           the margin for all text, including headings, not the amount by
66           which regular text is indented; for the latter, see the indent
67           option.  To set the right margin, see the width option.
68
69       nourls
70           Normally, L<> formatting codes with a URL but anchor text are
71           formatted to show both the anchor text and the URL.  In other
72           words:
73
74               L<foo|http://example.com/>
75
76           is formatted as:
77
78               foo <http://example.com/>
79
80           This option, if set to a true value, suppresses the URL when anchor
81           text is given, so this example would be formatted as just "foo".
82           This can produce less cluttered output in cases where the URLs are
83           not particularly important.
84
85       quotes
86           Sets the quote marks used to surround C<> text.  If the value is a
87           single character, it is used as both the left and right quote.
88           Otherwise, it is split in half, and the first half of the string is
89           used as the left quote and the second is used as the right quote.
90
91           This may also be set to the special value "none", in which case no
92           quote marks are added around C<> text.
93
94       sentence
95           If set to a true value, Pod::Text will assume that each sentence
96           ends in two spaces, and will try to preserve that spacing.  If set
97           to false, all consecutive whitespace in non-verbatim paragraphs is
98           compressed into a single space.  Defaults to false.
99
100       stderr
101           Send error messages about invalid POD to standard error instead of
102           appending a POD ERRORS section to the generated output.  This is
103           equivalent to setting "errors" to "stderr" if "errors" is not
104           already set.  It is supported for backward compatibility.
105
106       utf8
107           By default, Pod::Text uses the same output encoding as the input
108           encoding of the POD source (provided that Perl was built with
109           PerlIO; otherwise, it doesn't encode its output).  If this option
110           is given, the output encoding is forced to UTF-8.
111
112           Be aware that, when using this option, the input encoding of your
113           POD source should be properly declared unless it's US-ASCII.
114           Pod::Simple will attempt to guess the encoding and may be
115           successful if it's Latin-1 or UTF-8, but it will produce warnings.
116           Use the "=encoding" command to declare the encoding.  See
117           perlpod(1) for more information.
118
119       width
120           The column at which to wrap text on the right-hand side.  Defaults
121           to 76.
122
123       The standard Pod::Simple method parse_file() takes one argument naming
124       the POD file to read from.  By default, the output is sent to "STDOUT",
125       but this can be changed with the output_fh() method.
126
127       The standard Pod::Simple method parse_from_file() takes up to two
128       arguments, the first being the input file to read POD from and the
129       second being the file to write the formatted output to.
130
131       You can also call parse_lines() to parse an array of lines or
132       parse_string_document() to parse a document already in memory.  As with
133       parse_file(), parse_lines() and parse_string_document() default to
134       sending their output to "STDOUT" unless changed with the output_fh()
135       method.  Be aware that parse_lines() and parse_string_document() both
136       expect raw bytes, not decoded characters.
137
138       To put the output from any parse method into a string instead of a file
139       handle, call the output_string() method instead of output_fh().
140
141       See Pod::Simple for more specific details on the methods available to
142       all derived parsers.
143

DIAGNOSTICS

145       Bizarre space in item
146       Item called without tag
147           (W) Something has gone wrong in internal "=item" processing.  These
148           messages indicate a bug in Pod::Text; you should never see them.
149
150       Can't open %s for reading: %s
151           (F) Pod::Text was invoked via the compatibility mode pod2text()
152           interface and the input file it was given could not be opened.
153
154       Invalid errors setting "%s"
155           (F) The "errors" parameter to the constructor was set to an unknown
156           value.
157
158       Invalid quote specification "%s"
159           (F) The quote specification given (the "quotes" option to the
160           constructor) was invalid.  A quote specification must be either one
161           character long or an even number (greater than one) characters
162           long.
163
164       POD document had syntax errors
165           (F) The POD document being formatted had syntax errors and the
166           "errors" option was set to "die".
167

BUGS

169       Encoding handling assumes that PerlIO is available and does not work
170       properly if it isn't.  The "utf8" option is therefore not supported
171       unless Perl is built with PerlIO support.
172

CAVEATS

174       If Pod::Text is given the "utf8" option, the encoding of its output
175       file handle will be forced to UTF-8 if possible, overriding any
176       existing encoding.  This will be done even if the file handle is not
177       created by Pod::Text and was passed in from outside.  This maintains
178       consistency regardless of PERL_UNICODE and other settings.
179
180       If the "utf8" option is not given, the encoding of its output file
181       handle will be forced to the detected encoding of the input POD, which
182       preserves whatever the input text is.  This ensures backward
183       compatibility with earlier, pre-Unicode versions of this module,
184       without large numbers of Perl warnings.
185
186       This is not ideal, but it seems to be the best compromise.  If it
187       doesn't work for you, please let me know the details of how it broke.
188

NOTES

190       This is a replacement for an earlier Pod::Text module written by Tom
191       Christiansen.  It has a revamped interface, since it now uses
192       Pod::Simple, but an interface roughly compatible with the old
193       Pod::Text::pod2text() function is still available.  Please change to
194       the new calling convention, though.
195
196       The original Pod::Text contained code to do formatting via termcap
197       sequences, although it wasn't turned on by default and it was
198       problematic to get it to work at all.  This rewrite doesn't even try to
199       do that, but a subclass of it does.  Look for Pod::Text::Termcap.
200

AUTHOR

202       Russ Allbery <rra@cpan.org>, based very heavily on the original
203       Pod::Text by Tom Christiansen <tchrist@mox.perl.com> and its conversion
204       to Pod::Parser by Brad Appleton <bradapp@enteract.com>.  Sean Burke's
205       initial conversion of Pod::Man to use Pod::Simple provided much-needed
206       guidance on how to use Pod::Simple.
207
209       Copyright 1999-2002, 2004, 2006, 2008-2009, 2012-2016, 2018-2019 Russ
210       Allbery <rra@cpan.org>
211
212       This program is free software; you may redistribute it and/or modify it
213       under the same terms as Perl itself.
214

SEE ALSO

216       Pod::Simple, Pod::Text::Termcap, perlpod(1), pod2text(1)
217
218       The current version of this module is always available from its web
219       site at <https://www.eyrie.org/~eagle/software/podlators/>.  It is also
220       part of the Perl core distribution as of 5.6.0.
221
222
223
224perl v5.34.0                      2022-01-21                      Pod::Text(3)
Impressum