1Pod::PlainText(3) User Contributed Perl Documentation Pod::PlainText(3)
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 NOTE: This module is considered legacy; modern Perl releases (5.18 and
20 higher) are going to remove Pod-Parser from core and use Pod-Simple for
21 all things POD.
22
23 Pod::PlainText is a module that can convert documentation in the POD
24 format (the preferred language for documenting Perl) into formatted
25 ASCII. It uses no special formatting controls or codes whatsoever, and
26 its output is therefore suitable for nearly any device.
27
28 As a derived class from Pod::Parser, Pod::PlainText supports the same
29 methods and interfaces. See Pod::Parser for all the details; briefly,
30 one creates a new parser with "Pod::PlainText->new()" and then calls
31 either parse_from_filehandle() or parse_from_file().
32
33 new() can take options, in the form of key/value pairs, that control
34 the behavior of the parser. The currently recognized options are:
35
36 alt If set to a true value, selects an alternate output format that,
37 among other things, uses a different heading style and marks
38 "=item" entries with a colon in the left margin. Defaults to
39 false.
40
41 indent
42 The number of spaces to indent regular text, and the default
43 indentation for "=over" blocks. Defaults to 4.
44
45 loose
46 If set to a true value, a blank line is printed after a "=headN"
47 headings. If set to false (the default), no blank line is printed
48 after "=headN". This is the default because it's the expected
49 formatting for manual pages; if you're formatting arbitrary text
50 documents, setting this to true may result in more pleasing output.
51
52 sentence
53 If set to a true value, Pod::PlainText will assume that each
54 sentence ends in two spaces, and will try to preserve that spacing.
55 If set to false, all consecutive whitespace in non-verbatim
56 paragraphs is compressed into a single space. Defaults to true.
57
58 width
59 The column at which to wrap text on the right-hand side. Defaults
60 to 76.
61
62 The standard Pod::Parser method parse_from_filehandle() takes up to two
63 arguments, the first being the file handle to read POD from and the
64 second being the file handle to write the formatted output to. The
65 first defaults to STDIN if not given, and the second defaults to
66 STDOUT. The method parse_from_file() is almost identical, except that
67 its two arguments are the input and output disk files instead. See
68 Pod::Parser for the specific details.
69
71 Bizarre space in item
72 (W) Something has gone wrong in internal "=item" processing. This
73 message indicates a bug in Pod::PlainText; you should never see it.
74
75 Can't open %s for reading: %s
76 (F) Pod::PlainText was invoked via the compatibility mode
77 pod2text() interface and the input file it was given could not be
78 opened.
79
80 Unknown escape: %s
81 (W) The POD source contained an "E<>" escape that Pod::PlainText
82 didn't know about.
83
84 Unknown sequence: %s
85 (W) The POD source contained a non-standard internal sequence
86 (something of the form "X<>") that Pod::PlainText didn't know
87 about.
88
89 Unmatched =back
90 (W) Pod::PlainText encountered a "=back" command that didn't
91 correspond to an "=over" command.
92
94 Embedded Ctrl-As (octal 001) in the input will be mapped to spaces on
95 output, due to an internal implementation detail.
96
98 This is a replacement for an earlier Pod::Text module written by Tom
99 Christiansen. It has a revamped interface, since it now uses
100 Pod::Parser, but an interface roughly compatible with the old
101 Pod::Text::pod2text() function is still available. Please change to
102 the new calling convention, though.
103
104 The original Pod::Text contained code to do formatting via termcap
105 sequences, although it wasn't turned on by default and it was
106 problematic to get it to work at all. This rewrite doesn't even try to
107 do that, but a subclass of it does. Look for Pod::Text::Termcap.
108
110 Pod::PlainText is part of the Pod::Parser distribution.
111
112 Pod::Parser, Pod::Text::Termcap, pod2text(1)
113
115 Please report bugs using <http://rt.cpan.org>.
116
117 Russ Allbery <rra@stanford.edu>, based very heavily on the original
118 Pod::Text by Tom Christiansen <tchrist@mox.perl.com> and its conversion
119 to Pod::Parser by Brad Appleton <bradapp@enteract.com>.
120
121
122
123perl v5.28.0 2015-02-01 Pod::PlainText(3)