Pod::Spelling - Send POD to a spelling checker
use Pod::Spelling; my $o = Pod::Spelling->new(); say 'Spelling errors: ', join ', ', $o->check_file( 'Module.pm' ); use Pod::Spelling; my $o = Pod::Spelling->new( import => 'My::Speller' ); say 'Spelling errors: ', join ', ', $o->check_file( 'Module.pm' ); use Pod::Spelling; my $o = Pod::Spelling->new( allow_words => [qw[ foo bar ]], ); say 'Spelling errors: ', join ', ', $o->check_file( 'Module.pm' );
This module provides extensible spell-checking of POD.
At present, it requires either Lingua::Ispell or Text::Aspell, one of which must be installed on your system, with its binaries, unless you plan to use the API to provide your own spell-checker. In the latter case, or if binaries are missing from their default locations, expect test failures.
The items below commonly upset spell-checking, though are generally considered valid in POD, and so are not sent to the spell-checker.
The body of links (L<...>) and file-formatted strings (F<...>).
L<...>
F<...>
Verbatim blocks (indented text, as used in SYNOPSIS sections.
SYNOPSIS
Any string containing two colons (::).
::
The name of the module as written in the standard POD manner:
=head1 NAME Module::Name::Here - brief description here
Words contained in Pod::Wordlist, though that can be disabled - see Pod::Spelling for details.
Optional parameters:
allow_words
A list of words to remove from text prior to it being spell-checked.
no_pod_wordlist
Prevents the default behaviour of using Pod::Wordlist to ignore words often used in Perl modules, but rarely found in dictionaries.
import_speller
Name of a class to that implements the _init method and the Pod::Spelling::_spell_check_callback method. Current implementations are Pod::Spelling::Ispell and Pod::Spelling::Aspell. If anything else should be added, please let me know.
_init
Pod::Spelling::_spell_check_callback
If no import_speller is specified, then Ispell is tried, then Aspell, then the module croaks.
Ispell
Aspell
Pod::POM.
Accepts a path to a file, runs the spell check, and returns a list of badly-spelt words, setting the errors field with an array, each entry of which is a list that represents a line in the file, and thus may be empty if there are no spelling errors.
errors
Add a list of words to the 'allow' list specified at constrution.
This module is really just a factory class that does nothing but provide an API for sending POD to a spelling checker via a callback method, and returning the results.
The spell-checking callback method, supplied as a code reference in the spell_check_callback argument during construction, receives a list of text, and should return a list of badly-spelt words.
spell_check_callback
my $o = Pod::Spelling->new( spell_check_callback => sub { my ($self, @text) = @_; return $find_bad_words( \@text ); }, );
Alternatively, this module can be sub-classed: see the source of Pod::Spelling::Ispell.
Pod::Spelling::Ispell
Pod::Spelling::Ispell, Pod::POM, Pod::POM::View::TextBasic, Pod::Spell, Pod::WordList.
Copyright (C) Lee Goddard, 2011. All Rights Reserved.
Made available under the same terms as Perl.
To install Pod::Spelling, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pod::Spelling
CPAN shell
perl -MCPAN -e shell install Pod::Spelling
For more information on module installation, please visit the detailed CPAN module installation guide.