1Pod::Simple(3) User Contributed Perl Documentation Pod::Simple(3)
2
3
4
6 Pod::Simple - framework for parsing Pod
7
9 TODO
10
12 Pod::Simple is a Perl library for parsing text in the Pod ("plain old
13 documentation") markup language that is typically used for writing doc‐
14 umentation for Perl and for Perl modules. The Pod format is explained
15 in the perlpod man page; the most common formatter is called "perldoc".
16
17 Pod formatters can use Pod::Simple to parse Pod documents into produce
18 renderings of them in plain ASCII, in HTML, or in any number of other
19 formats. Typically, such formatters will be subclasses of Pod::Simple,
20 and so they will inherit its methods, like "parse_file".
21
22 If you're reading this document just because you have a Pod-processing
23 subclass that you want to use, this document (plus the documentation
24 for the subclass) is probably all you'll need to read.
25
26 If you're reading this document because you want to write a formatter
27 subclass, continue reading this document, and then read Pod::Sim‐
28 ple::Subclassing, and then possibly even read perlpodspec (some of
29 which is for parser-writers, but much of which is notes to format‐
30 ter-writers).
31
33 "$parser = SomeClass->new();"
34 This returns a new parser object, where "SomeClass" is a subclass
35 of Pod::Simple.
36
37 "$parser->output_fh( *OUT );"
38 This sets the filehandle that $parser's output will be written to.
39 You can pass *STDOUT, otherwise you should probably do something
40 like this:
41
42 my $outfile = "output.txt";
43 open TXTOUT, ">$outfile" or die "Can't write to $outfile: $!";
44 $parser->output_fh(*TXTOUT);
45
46 ...before you call one of the "$parser->parse_whatever" methods.
47
48 "$parser->output_string( \$somestring );"
49 This sets the string that $parser's output will be sent to, instead
50 of any filehandle.
51
52 "$parser->parse_file( $some_filename );"
53 "$parser->parse_file( *INPUT_FH );"
54 This reads the Pod content of the file (or filehandle) that you
55 specify, and processes it with that $parser object, according to
56 however $parser's class works, and according to whatever parser
57 options you have set up for this $parser object.
58
59 "$parser->parse_string_document( $all_content );"
60 This works just like "parse_file" except that it reads the Pod con‐
61 tent not from a file, but from a string that you have already in
62 memory.
63
64 "$parser->parse_lines( ...@lines..., undef );"
65 This processes the lines in @lines (where each list item must be a
66 defined value, and must contain exactly one line of content -- so
67 no items like "foo\nbar" are allowed). The final "undef" is used
68 to indicate the end of document being parsed.
69
70 The other "parser_whatever" methods are meant to be called only
71 once per $parser object; but "parse_lines" can be called as many
72 times per $parser object as you want, as long as the last call (and
73 only the last call) ends with an "undef" value.
74
75 "$parser->content_seen"
76 This returns true only if there has been any real content seen for
77 this document.
78
79 "SomeClass->filter( $filename );"
80 "SomeClass->filter( *INPUT_FH );"
81 "SomeClass->filter( \$document_content );"
82 This is a shortcut method for creating a new parser object, setting
83 the output handle to STDOUT, and then processing the specified file
84 (or filehandle, or in-memory document). This is handy for one-lin‐
85 ers like this:
86
87 perl -MPod::Simple::Text -e "Pod::Simple::Text->filter('thingy.pod')"
88
90 Some of these methods might be of interest to general users, as well as
91 of interest to formatter-writers.
92
93 Note that the general pattern here is that the accessor-methods read
94 the attribute's value with "$value = $parser->attribute" and set the
95 attribute's value with "$parser->attribute(newvalue)". For each acces‐
96 sor, I typically only mention one syntax or another, based on which I
97 think you are actually most likely to use.
98
99 "$parser->no_whining( SOMEVALUE )"
100 If you set this attribute to a true value, you will suppress the
101 parser's complaints about irregularities in the Pod coding. By
102 default, this attribute's value is false, meaning that irregulari‐
103 ties will be reported.
104
105 Note that turning this attribute to true won't suppress one or two
106 kinds of complaints about rarely occurring unrecoverable errors.
107
108 "$parser->no_errata_section( SOMEVALUE )"
109 If you set this attribute to a true value, you will stop the parser
110 from generating a "POD ERRORS" section at the end of the document.
111 By default, this attribute's value is false, meaning that an errata
112 section will be generated, as necessary.
113
114 "$parser->complain_stderr( SOMEVALUE )"
115 If you set this attribute to a true value, it will send reports of
116 parsing errors to STDERR. By default, this attribute's value is
117 false, meaning that no output is sent to STDERR.
118
119 Note that errors can be noted in an errata section, or sent to
120 STDERR, or both, or neither. So don't think that turning on "com‐
121 plain_stderr" will turn off "no_errata_section" or vice versa --
122 these are independent attributes.
123
124 "$parser->source_filename"
125 This returns the filename that this parser object was set to read
126 from.
127
128 "$parser->doc_has_started"
129 This returns true if $parser has read from a source, and has seen
130 Pod content in it.
131
132 "$parser->source_dead"
133 This returns true if $parser has read from a source, and come to
134 the end of that source.
135
137 This is just a beta release -- there are a good number of things still
138 left to do. Notably, support for EBCDIC platforms is still half-done,
139 an untested.
140
142 Pod::Simple::Subclassing
143
144 perlpod
145
146 perlpodspec
147
148 Pod::Escapes
149
150 perldoc
151
153 Copyright (c) 2002 Sean M. Burke. All rights reserved.
154
155 This library is free software; you can redistribute it and/or modify it
156 under the same terms as Perl itself.
157
158 This program is distributed in the hope that it will be useful, but
159 without any warranty; without even the implied warranty of mer‐
160 chantability or fitness for a particular purpose.
161
163 Original author: Sean M. Burke "sburke@cpan.org"
164
165 Maintained by: Allison Randal "allison@perl.org"
166
167
168
169perl v5.8.8 2003-11-02 Pod::Simple(3)