1Pod::Spell(3) User Contributed Perl Documentation Pod::Spell(3)
2
3
4
6 Pod::Spell - a formatter for spellchecking Pod
7
9 version 1.26
10
12 use Pod::Spell;
13 Pod::Spell->new->parse_from_file( 'File.pm' );
14
15 Pod::Spell->new->parse_from_filehandle( $infile, $outfile );
16
17 Also look at podspell
18
19 % perl -MPod::Spell -e "Pod::Spell->new->parse_from_file(shift)" Thing.pm |spell |fmt
20
21 ...or instead of piping to spell or "ispell", use ">temp.txt", and open
22 temp.txt in your word processor for spell-checking.
23
25 Pod::Spell is a Pod formatter whose output is good for spellchecking.
26 Pod::Spell is rather like Pod::Text, except that it doesn't put much
27 effort into actual formatting, and it suppresses things that look like
28 Perl symbols or Perl jargon (so that your spellchecking program won't
29 complain about mystery words like "$thing" or ""Foo::Bar"" or
30 "hashref").
31
32 This class works by filtering out words that look like Perl or any form
33 of computerese (like "$thing" or ""N>7"" or ""@{$foo}{'bar','baz'}"",
34 anything in C<...> or F<...> codes, anything in verbatim paragraphs
35 (code blocks), and anything in the stopword list. The default stopword
36 list for a document starts out from the stopword list defined by
37 Pod::Wordlist, and can be supplemented (on a per-document basis) by
38 having "=for stopwords" / "=for :stopwords" region(s) in a document.
39
41 new
42 Pod::Spell->new(%options)
43
44 Creates a new Pod::Spell instance. Accepts several options:
45
46 debug
47 When set to a true value, will output debugging messages about how
48 the Pod is being processed.
49
50 Defaults to false.
51
52 stopwords
53 Can be specified to use an alternate wordlist instance.
54
55 Defaults to a new Pod::Wordlist instance.
56
57 no_wide_chars
58 Will be passed to Pod::Wordlist when creating a new instance.
59 Causes all words with characters outside the Latin-1 range to be
60 stripped from the output.
61
62 stopwords
63 $self->stopwords->isa('Pod::WordList'); # true
64
65 parse_from_filehandle($in_fh,$out_fh)
66 This method takes an input filehandle (which is assumed to already be
67 opened for reading) and reads the entire input stream looking for
68 blocks (paragraphs) of POD documentation to be processed. If no first
69 argument is given the default input filehandle "STDIN" is used.
70
71 The $in_fh parameter may be any object that provides a getline() method
72 to retrieve a single line of input text (hence, an appropriate wrapper
73 object could be used to parse PODs from a single string or an array of
74 strings).
75
76 parse_from_file($filename,$outfile)
77 This method takes a filename and does the following:
78
79 • opens the input and output files for reading (creating the
80 appropriate filehandles)
81
82 • invokes the parse_from_filehandle() method passing it the
83 corresponding input and output filehandles.
84
85 • closes the input and output files.
86
87 If the special input filename "", "-" or "<&STDIN" is given then the
88 STDIN filehandle is used for input (and no open or close is performed).
89 If no input filename is specified then "-" is implied. Filehandle
90 references, or objects that support the regular IO operations (like
91 "<$fh>" or "$fh-<Egt"getline>) are also accepted; the handles must
92 already be opened.
93
94 If a second argument is given then it should be the name of the desired
95 output file. If the special output filename "-" or ">&STDOUT" is given
96 then the STDOUT filehandle is used for output (and no open or close is
97 performed). If the special output filename ">&STDERR" is given then the
98 STDERR filehandle is used for output (and no open or close is
99 performed). If no output filehandle is currently in use and no output
100 filename is specified, then "-" is implied. Alternatively, filehandle
101 references or objects that support the regular IO operations (like
102 "print", e.g. IO::String) are also accepted; the object must already be
103 opened.
104
106 If your Pod is encoded in something other than Latin-1, it should
107 declare an encoding using the ""=encoding encodingname"" in perlpod
108 directive.
109
111 You can add stopwords on a per-document basis with "=for stopwords" /
112 "=for :stopwords" regions, like so:
113
114 =for stopwords plok Pringe zorch snik !qux
115 foo bar baz quux quuux
116
117 This adds every word in that paragraph after "stopwords" to the
118 stopword list, effective for the rest of the document. In such a list,
119 words are whitespace-separated. (The amount of whitespace doesn't
120 matter, as long as there's no blank lines in the middle of the
121 paragraph.) Plural forms are added automatically using
122 Lingua::EN::Inflect. Words beginning with "!" are deleted from the
123 stopword list -- so "!qux" deletes "qux" from the stopword list, if it
124 was in there in the first place. Note that if a stopword is all-
125 lowercase, then it means that it's okay in any case; but if the word
126 has any capital letters, then it means that it's okay only with that
127 case. So a Wordlist entry of "perl" would permit "perl", "Perl", and
128 (less interestingly) "PERL", "pERL", "PerL", et cetera. However, a
129 Wordlist entry of "Perl" catches only "Perl", not "perl". So if you
130 wanted to make sure you said only "Perl", never "perl", you could add
131 this to the top of your document:
132
133 =for stopwords !perl Perl
134
135 Then all instances of the word "Perl" would be weeded out of the
136 Pod::Spell-formatted version of your document, but any instances of the
137 word "perl" would be left in (unless they were in a C<...> or F<...>
138 style).
139
140 You can have several "=for stopwords" regions in your document. You
141 can even express them like so:
142
143 =begin stopwords
144
145 plok Pringe zorch
146
147 snik !qux
148
149 foo bar
150 baz quux quuux
151
152 =end stopwords
153
154 If you want to use E<...> sequences in a "stopwords" region, you have
155 to use ":stopwords", as here:
156
157 =for :stopwords
158 virtE<ugrave>
159
160 ...meaning that you're adding a stopword of "virtù". If you left the
161 ":" out, that would mean you were adding a stopword of "virtE<ugrave>"
162 (with a literal E, a literal <, etc), which will have no effect, since
163 any occurrences of virtE<ugrave> don't look like a normal human-
164 language word anyway, and so would be screened out before the stopword
165 list is consulted anyway.
166
168 finding stopwords defined with "=for"
169 Pod::Spell makes a single pass over the POD. Stopwords must be added
170 before they show up in the POD.
171
173 If you feed output of Pod::Spell into your word processor and run a
174 spell-check, make sure you're not also running a grammar-check --
175 because Pod::Spell drops words that it thinks are Perl symbols, jargon,
176 or stopwords, this means you'll have ungrammatical sentences, what with
177 words being missing and all. And you don't need a grammar checker to
178 tell you that.
179
181 • Pod::Wordlist
182
183 • Pod::Simple
184
185 • podchecker also known as Pod::Checker
186
187 • perlpod, perlpodspec
188
190 Please report any bugs or feature requests on the bugtracker website
191 <https://rt.cpan.org/Public/Dist/Display.html?Name=Pod-Spell> or by
192 email to bug-Pod-Spell@rt.cpan.org <mailto:bug-Pod-Spell@rt.cpan.org>.
193
194 When submitting a bug or request, please include a test-file or a patch
195 to an existing test-file that illustrates the bug or desired feature.
196
198 • David Golden <dagolden@cpan.org>
199
200 • Graham Knop <haarg@haarg.org>
201
202 • Kent Fredric <kentfredric@gmail.com>
203
204 • Mohammad S Anwar <mohammad.anwar@yahoo.com>
205
206 • Olivier Mengué <dolmen@cpan.org>
207
208 • Paulo Custodio <pauloscustodio@gmail.com>
209
211 • Sean M. Burke <sburke@cpan.org>
212
213 • Caleb Cushing <xenoterracide@gmail.com>
214
216 This software is Copyright (c) 2023 by Olivier Mengué.
217
218 This is free software, licensed under:
219
220 The Artistic License 2.0 (GPL Compatible)
221
222
223
224perl v5.36.0 2023-03-14 Pod::Spell(3)