1Pod::PlainText(3pm) Perl Programmers Reference Guide Pod::PlainText(3pm)
2
3
4
6 Pod::PlainText - Convert POD data to formatted ASCII text
7
9 use Pod::PlainText;
10 my $parser = Pod::PlainText->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::PlainText is a module that can convert documentation in the POD
20 format (the preferred language for documenting Perl) into formatted
21 ASCII. It uses no special formatting controls or codes whatsoever, and
22 its output is therefore suitable for nearly any device.
23
24 As a derived class from Pod::Parser, Pod::PlainText supports the same
25 methods and interfaces. See Pod::Parser for all the details; briefly,
26 one creates a new parser with "Pod::PlainText->new()" and then calls
27 either 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 indent
38 The number of spaces to indent regular text, and the default inden‐
39 tation for "=over" blocks. Defaults to 4.
40
41 loose
42 If set to a true value, a blank line is printed after a "=head1"
43 heading. If set to false (the default), no blank line is printed
44 after "=head1", although one is still printed after "=head2". This
45 is the default because it's the expected formatting for manual
46 pages; if you're formatting arbitrary text documents, setting this
47 to true may result in more pleasing output.
48
49 sentence
50 If set to a true value, Pod::PlainText will assume that each sen‐
51 tence ends in two spaces, and will try to preserve that spacing.
52 If set to false, all consecutive whitespace in non-verbatim para‐
53 graphs is compressed into a single space. Defaults to true.
54
55 width
56 The column at which to wrap text on the right-hand side. Defaults
57 to 76.
58
59 The standard Pod::Parser method parse_from_filehandle() takes up to two
60 arguments, the first being the file handle to read POD from and the
61 second being the file handle to write the formatted output to. The
62 first defaults to STDIN if not given, and the second defaults to STD‐
63 OUT. The method parse_from_file() is almost identical, except that its
64 two arguments are the input and output disk files instead. See
65 Pod::Parser for the specific details.
66
68 Bizarre space in item
69 (W) Something has gone wrong in internal "=item" processing. This
70 message indicates a bug in Pod::PlainText; you should never see it.
71
72 Can't open %s for reading: %s
73 (F) Pod::PlainText was invoked via the compatibility mode
74 pod2text() interface and the input file it was given could not be
75 opened.
76
77 Unknown escape: %s
78 (W) The POD source contained an "E<>" escape that Pod::PlainText
79 didn't know about.
80
81 Unknown sequence: %s
82 (W) The POD source contained a non-standard internal sequence
83 (something of the form "X<>") that Pod::PlainText didn't know
84 about.
85
86 Unmatched =back
87 (W) Pod::PlainText encountered a "=back" command that didn't corre‐
88 spond to an "=over" command.
89
91 Embedded Ctrl-As (octal 001) in the input will be mapped to spaces on
92 output, due to an internal implementation detail.
93
95 This is a replacement for an earlier Pod::Text module written by Tom
96 Christiansen. It has a revamped interface, since it now uses
97 Pod::Parser, but an interface roughly compatible with the old
98 Pod::Text::pod2text() function is still available. Please change to
99 the new calling convention, though.
100
101 The original Pod::Text contained code to do formatting via termcap
102 sequences, although it wasn't turned on by default and it was problem‐
103 atic to get it to work at all. This rewrite doesn't even try to do
104 that, but a subclass of it does. Look for Pod::Text::Termcap.
105
107 Pod::Parser, Pod::Text::Termcap, pod2text(1)
108
110 Please report bugs using <http://rt.cpan.org>.
111
112 Russ Allbery <rra@stanford.edu>, based very heavily on the original
113 Pod::Text by Tom Christiansen <tchrist@mox.perl.com> and its conversion
114 to Pod::Parser by Brad Appleton <bradapp@enteract.com>.
115
116
117
118perl v5.8.8 2001-09-21 Pod::PlainText(3pm)