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 ]], ); $o->skip_paths_matching( qr{*/DBIC} ); 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.
L<...>
) and file-formatted strings (F<...>
).SYNOPSIS
sections.::
).=head1 NAME Module::Name::Here - brief description here
no_pod_wordlist
, below.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.
If no import_speller
is specified, then Ispell
is tried, then Aspell
, then the module croaks.
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.
Add a list of words to the 'allow' list specified at instantiation.
Supply a list of one or more pre-compiled regular expressions to avoid parsing directories they match.
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.
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::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.