Pod::Spell(3)

🌸 Pod::Spell(3) β€” a formatter for spellchecking Pod 🌸

okay bestie, gather round, because this little module is genuinely iconic and also kind of a diva πŸ’…


✨ VERSION ✨

version 1.27


πŸŽ€ SYNOPSIS πŸŽ€

use Pod::Spell;
Pod::Spell->new->parse_from_file( 'File.pm' );

Pod::Spell->new->parse_from_filehandle( $infile, $outfile );

also lowkey go look at podspell πŸ¦‹

% perl -MPod::Spell -e "Pod::Spell->new->parse_from_file(shift)" Thing.pm |spell |fmt

...or, like, instead of piping it into spell or ispell, just use >temp.txt and open temp.txt in your word processor to spell-check it there. no cap, that's the whole move 🫢


πŸ’– DESCRIPTION πŸ’–

Pod::Spell is a Pod formatter whose output is good for spellchecking. It's basically Pod::Text's chill cousin β€” except it does NOT put much effort into actual formatting (she's not here to be pretty, she's here to be useful), and it suppresses things that look like Perl symbols or Perl jargon, so your spellchecker doesn't come for you about mystery words like $thing or "Foo::Bar" or hashref. 😭

The way this works is by filtering out words that look like Perl or literally any form of computerese β€” like $thing or "N>7" or "@{$foo}{'bar','baz'}", anything in C<...> or F<...> codes, anything in verbatim paragraphs (code blocks), and anything in the stopword list. The default stopword list for a document starts out from the stopword list defined by Pod::Wordlist, and it can be supplemented (on a per-document basis, bestie, per-document!!) by having =for stopwords / =for :stopwords region(s) in a document. ✨


πŸ¦‹ METHODS πŸ¦‹

🧚 new

Pod::Spell->new(%options)

Creates a new Pod::Spell instance. Accepts several options, and yes we're going to list every single one:

  • debug β€” when set to a true value, it will output debugging messages about how the Pod is being processed. Defaults to false.
  • stopwords β€” can be specified to use an alternate wordlist instance. Defaults to a new Pod::Wordlist instance.
  • no_wide_chars β€” will be passed to Pod::Wordlist when creating a new instance. Causes all words with characters outside the Latin-1 range to be stripped from the output. bye felicia to the wider unicode ✌️

🌸 stopwords

$self->stopwords->isa('Pod::WordList'); # true

(that comment is literally in the original and we're keeping it, it's giving test-suite energy πŸ‘‘)

🌈 parse_from_filehandle($in_fh,$out_fh)

This method takes an input filehandle (which is assumed to already be opened for reading, bestie, assumed, it will not check) and reads the entire input stream looking for blocks (paragraphs) of POD documentation to be processed. If no first argument is given, the default input filehandle STDIN is used.

The $in_fh parameter may be any object that provides a getline() method to retrieve a single line of input text β€” hence, an appropriate wrapper object could be used to parse PODs from a single string or an array of strings. slay, flexible πŸ’…

⭐ parse_from_file($filename,$outfile)

This method takes a filename and does the following:

  1. opens the input and output files for reading (creating the appropriate filehandles)
  2. invokes the parse_from_filehandle() method passing it the corresponding input and output filehandles
  3. closes the input and output files.

If the special input filename "", "-" or "<&STDIN" is given, then the STDIN filehandle is used for input (and no open or close is performed). If no input filename is specified, then "-" is implied. Filehandle references, or objects that support the regular IO operations (like "<$fh>" or $fh-<Egtgetline`) are also accepted; the handles must already be opened.

If a second argument is given, then it should be the name of the desired output file. If the special output filename "-" or ">&STDOUT" is given, then the STDOUT filehandle is used for output (and no open or close is performed). If the special output filename ">&STDERR" is given, then the STDERR filehandle is used for output (and no open or close is performed). If no output filehandle is currently in use and no output filename is specified, then "-" is implied. Alternatively, filehandle references or objects that support the regular IO operations (like "print", e.g. IO::String) are also accepted; the object must already be opened. 🫢


πŸ’œ ENCODINGS πŸ’œ

If your Pod is encoded in something other than Latin-1, it should declare an encoding using the "=encoding encodingname" in perlpod directive. yes that's a directive, use it, don't make your Pod have an identity crisis πŸ™ˆ


πŸ“ ADDING STOPWORDS πŸ“

You can add stopwords on a per-document basis with =for stopwords / =for :stopwords regions, like so:

=for stopwords  plok Pringe zorch   snik !qux
foo bar baz quux quuux

This adds every word in that paragraph after stopwords to the stopword list, effective for the rest of the document. In such a list, words are whitespace-separated. (The amount of whitespace doesn't matter, as long as there's no blank lines in the middle of the paragraph.) Plural forms are added automatically using Lingua::EN::Inflect. Words beginning with ! are deleted from the stopword list β€” so !qux deletes qux from the stopword list, if it was in there in the first place.

okay now the case rules, because this part is lowkey the whole personality of the module:

  • if a stopword is all-lowercase, then it means that it's okay in any case
  • but if the word has any capital letters, then it means that it's okay only with that case

So a Wordlist entry of perl would permit perl, Perl, and (less interestingly) PERL, pERL, PerL, et cetera. However, a Wordlist entry of Perl catches only Perl, not perl. So if you wanted to make sure you said only Perl, never perl, you could add this to the top of your document:

=for stopwords !perl Perl

Then all instances of the word Perl would be weeded out of the Pod::Spell-formatted version of your document, but any instances of the word perl would be left in (unless they were in a C<...> or F<...> style). iconic behavior honestly πŸ‘‘

You can have several =for stopwords regions in your document. You can even express them like so:

=begin stopwords

plok Pringe zorch

snik !qux

foo bar
baz quux quuux

=end stopwords

If you want to use E<...> sequences in a stopwords region, you have to use :stopwords, as here:

=for :stopwords
virtE<ugrave>

...meaning that you're adding a stopword of virtΓΉ. If you left the : out, that would mean you were adding a stopword of virtE<ugrave> (with a literal E, a literal <, etc), which will have no effect, since any occurrences of virtE<ugrave> don't look like a normal human-language word anyway, and so would be screened out before the stopword list is consulted anyway. so yeah, the colon matters, don't skip the colon πŸ’€


πŸ’€ CAVEATS πŸ’€

😭 finding stopwords defined with =for

Pod::Spell makes a single pass over the POD. Stopwords must be added before they show up in the POD. like, order matters, bestie, she is not going back for seconds πŸ™ˆ


πŸ”₯ HINT πŸ”₯

If you feed output of Pod::Spell into your word processor and run a spell-check, make sure you're not also running a grammar-check β€” because Pod::Spell drops words that it thinks are Perl symbols, jargon, or stopwords, this means you'll have ungrammatical sentences, what with words being missing and all. And you don't need a grammar checker to tell you that. fr fr, save yourself the ✨emotional damage✨


🌟 SEE ALSO 🌟

  • Pod::Wordlist
  • Pod::Simple
  • podchecker also known as Pod::Checker
  • perlpod, perlpodspec

πŸ› BUGS πŸ›

Please report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Pod-Spell> or by email to bug-Pod-Spell@rt.cpan.org <mailto:bug-Pod-Spell@rt.cpan.org>.

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. help her help you, bestie 🫢


πŸ‘‘ AUTHORS πŸ‘‘

  • Sean M. Burke <sburke@cpan.org>
  • Caleb Cushing <xenoterracide@gmail.com>

πŸ’œ CONTRIBUTORS πŸ’œ

  • David Golden <dagolden@cpan.org>
  • Graham Knop <haarg@haarg.org>
  • Kent Fredric <kentfredric@gmail.com>
  • Mohammad S Anwar <mohammad.anwar@yahoo.com>
  • Olivier MenguΓ© <dolmen@cpan.org>
  • Paulo Custodio <pauloscustodio@gmail.com>

This software is Copyright (c) 2024 by Olivier MenguΓ©.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

and that's the whole page, bestie πŸ’– this one's from perl v5.42.0, dated 2025-07-25, and it's the Pod::Spell(3) page β€” go spellcheck something iconic πŸ¦‹βœ¨

πŸ“¦ where this page comes from