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

NAME

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

SYNOPSIS

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

DESCRIPTION

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::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 "output".
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; if
88           it is two characters, the first character is used as the left quote
89           and the second as the right quoted; and if it is four characters,
90           the first two are used as the left quote and the second two as the
91           right quote.
92
93           This may also be set to the special value "none", in which case no
94           quote marks are added around C<> text.
95
96       sentence
97           If set to a true value, Pod::Text will assume that each sentence
98           ends in two spaces, and will try to preserve that spacing.  If set
99           to false, all consecutive whitespace in non-verbatim paragraphs is
100           compressed into a single space.  Defaults to true.
101
102       stderr
103           Send error messages about invalid POD to standard error instead of
104           appending a POD ERRORS section to the generated output.  This is
105           equivalent to setting "errors" to "stderr" if "errors" is not
106           already set.  It is supported for backward compatibility.
107
108       utf8
109           By default, Pod::Text uses the same output encoding as the input
110           encoding of the POD source (provided that Perl was built with
111           PerlIO; otherwise, it doesn't encode its output).  If this option
112           is given, the output encoding is forced to UTF-8.
113
114           Be aware that, when using this option, the input encoding of your
115           POD source must be properly declared unless it is US-ASCII or
116           Latin-1.  POD input without an "=encoding" command will be assumed
117           to be in Latin-1, and if it's actually in UTF-8, the output will be
118           double-encoded.  See perlpod(1) for more information on the
119           "=encoding" command.
120
121       width
122           The column at which to wrap text on the right-hand side.  Defaults
123           to 76.
124
125       The standard Pod::Simple method parse_file() takes one argument, the
126       file or file handle to read from, and writes output to standard output
127       unless that has been changed with the output_fh() method.  See
128       Pod::Simple for the specific details and for other alternative
129       interfaces.
130

DIAGNOSTICS

132       Bizarre space in item
133       Item called without tag
134           (W) Something has gone wrong in internal "=item" processing.  These
135           messages indicate a bug in Pod::Text; you should never see them.
136
137       Can't open %s for reading: %s
138           (F) Pod::Text was invoked via the compatibility mode pod2text()
139           interface and the input file it was given could not be opened.
140
141       Invalid errors setting "%s"
142           (F) The "errors" parameter to the constructor was set to an unknown
143           value.
144
145       Invalid quote specification "%s"
146           (F) The quote specification given (the "quotes" option to the
147           constructor) was invalid.  A quote specification must be one, two,
148           or four characters long.
149
150       POD document had syntax errors
151           (F) The POD document being formatted had syntax errors and the
152           "errors" option was set to "die".
153

BUGS

155       Encoding handling assumes that PerlIO is available and does not work
156       properly if it isn't.  The "utf8" option is therefore not supported
157       unless Perl is built with PerlIO support.
158

CAVEATS

160       If Pod::Text is given the "utf8" option, the encoding of its output
161       file handle will be forced to UTF-8 if possible, overriding any
162       existing encoding.  This will be done even if the file handle is not
163       created by Pod::Text and was passed in from outside.  This maintains
164       consistency regardless of PERL_UNICODE and other settings.
165
166       If the "utf8" option is not given, the encoding of its output file
167       handle will be forced to the detected encoding of the input POD, which
168       preserves whatever the input text is.  This ensures backward
169       compatibility with earlier, pre-Unicode versions of this module,
170       without large numbers of Perl warnings.
171
172       This is not ideal, but it seems to be the best compromise.  If it
173       doesn't work for you, please let me know the details of how it broke.
174

NOTES

176       This is a replacement for an earlier Pod::Text module written by Tom
177       Christiansen.  It has a revamped interface, since it now uses
178       Pod::Simple, but an interface roughly compatible with the old
179       Pod::Text::pod2text() function is still available.  Please change to
180       the new calling convention, though.
181
182       The original Pod::Text contained code to do formatting via termcap
183       sequences, although it wasn't turned on by default and it was
184       problematic to get it to work at all.  This rewrite doesn't even try to
185       do that, but a subclass of it does.  Look for Pod::Text::Termcap.
186

SEE ALSO

188       Pod::Simple, Pod::Text::Termcap, perlpod(1), pod2text(1)
189
190       The current version of this module is always available from its web
191       site at <http://www.eyrie.org/~eagle/software/podlators/>.  It is also
192       part of the Perl core distribution as of 5.6.0.
193

AUTHOR

195       Russ Allbery <rra@stanford.edu>, based very heavily on the original
196       Pod::Text by Tom Christiansen <tchrist@mox.perl.com> and its conversion
197       to Pod::Parser by Brad Appleton <bradapp@enteract.com>.  Sean Burke's
198       initial conversion of Pod::Man to use Pod::Simple provided much-needed
199       guidance on how to use Pod::Simple.
200
202       Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009, 2012, 2013
203       Russ Allbery <rra@stanford.edu>.
204
205       This program is free software; you may redistribute it and/or modify it
206       under the same terms as Perl itself.
207
208
209
210perl v5.16.3                      2013-01-02                      Pod::Text(3)
Impressum