1Pod::Text(3pm)         Perl Programmers Reference Guide         Pod::Text(3pm)
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       indent
43           The number of spaces to indent regular text, and the default
44           indentation 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       stderr
78           Send error messages about invalid POD to standard error instead of
79           appending a POD ERRORS section to the generated output.
80
81       utf8
82           By default, Pod::Text uses the same output encoding as the input
83           encoding of the POD source (provided that Perl was built with
84           PerlIO; otherwise, it doesn't encode its output).  If this option
85           is given, the output encoding is forced to UTF-8.
86
87           Be aware that, when using this option, the input encoding of your
88           POD source must be properly declared unless it is US-ASCII or
89           Latin-1.  POD input without an "=encoding" command will be assumed
90           to be in Latin-1, and if it's actually in UTF-8, the output will be
91           double-encoded.  See perlpod(1) for more information on the
92           "=encoding" command.
93
94       width
95           The column at which to wrap text on the right-hand side.  Defaults
96           to 76.
97
98       The standard Pod::Simple method parse_file() takes one argument, the
99       file or file handle to read from, and writes output to standard output
100       unless that has been changed with the output_fh() method.  See
101       Pod::Simple for the specific details and for other alternative
102       interfaces.
103

DIAGNOSTICS

105       Bizarre space in item
106       Item called without tag
107           (W) Something has gone wrong in internal "=item" processing.  These
108           messages indicate a bug in Pod::Text; you should never see them.
109
110       Can't open %s for reading: %s
111           (F) Pod::Text was invoked via the compatibility mode pod2text()
112           interface and the input file it was given could not be opened.
113
114       Invalid quote specification "%s"
115           (F) The quote specification given (the quotes option to the
116           constructor) was invalid.  A quote specification must be one, two,
117           or four characters long.
118

BUGS

120       Encoding handling assumes that PerlIO is available and does not work
121       properly if it isn't.  The "utf8" option is therefore not supported
122       unless Perl is built with PerlIO support.
123

CAVEATS

125       If Pod::Text is given the "utf8" option, the encoding of its output
126       file handle will be forced to UTF-8 if possible, overriding any
127       existing encoding.  This will be done even if the file handle is not
128       created by Pod::Text and was passed in from outside.  This maintains
129       consistency regardless of PERL_UNICODE and other settings.
130
131       If the "utf8" option is not given, the encoding of its output file
132       handle will be forced to the detected encoding of the input POD, which
133       preserves whatever the input text is.  This ensures backward
134       compatibility with earlier, pre-Unicode versions of this module,
135       without large numbers of Perl warnings.
136
137       This is not ideal, but it seems to be the best compromise.  If it
138       doesn't work for you, please let me know the details of how it broke.
139

NOTES

141       This is a replacement for an earlier Pod::Text module written by Tom
142       Christiansen.  It has a revamped interface, since it now uses
143       Pod::Simple, but an interface roughly compatible with the old
144       Pod::Text::pod2text() function is still available.  Please change to
145       the new calling convention, though.
146
147       The original Pod::Text contained code to do formatting via termcap
148       sequences, although it wasn't turned on by default and it was
149       problematic to get it to work at all.  This rewrite doesn't even try to
150       do that, but a subclass of it does.  Look for Pod::Text::Termcap.
151

SEE ALSO

153       Pod::Simple, Pod::Text::Termcap, perlpod(1), pod2text(1)
154
155       The current version of this module is always available from its web
156       site at <http://www.eyrie.org/~eagle/software/podlators/>.  It is also
157       part of the Perl core distribution as of 5.6.0.
158

AUTHOR

160       Russ Allbery <rra@stanford.edu>, based very heavily on the original
161       Pod::Text by Tom Christiansen <tchrist@mox.perl.com> and its conversion
162       to Pod::Parser by Brad Appleton <bradapp@enteract.com>.  Sean Burke's
163       initial conversion of Pod::Man to use Pod::Simple provided much-needed
164       guidance on how to use Pod::Simple.
165
167       Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008 Russ Allbery
168       <rra@stanford.edu>.
169
170       This program is free software; you may redistribute it and/or modify it
171       under the same terms as Perl itself.
172
173
174
175perl v5.10.1                      2017-03-22                    Pod::Text(3pm)
Impressum