NAME
Pod::Spelling - Send POD to a spelling checker
SYNOPSIS
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' );
DESCRIPTION
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.
TEXT NOT SPELL-CHECKED
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<...>
).Verbatim blocks (indented text, as used in
SYNOPSIS
sections.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 the
no_pod_wordlist
, below.
CONSTRUCTOR (new)
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 thePod::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.
DEPENDENCIES
METHODS
check_file
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_allow_words
Add a list of words to the 'allow' list specified at instantiation.
skip_paths_matching
Supply a list of one or more pre-compiled regular expressions to avoid parsing directories they match.
ADDING A SPELL-CHECKER
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
.
SEE ALSO
Pod::Spelling::Ispell, Pod::POM, Pod::POM::View::TextBasic, Pod::Spell, Pod::WordList.
AUTHOR AND COPYRIGHT
Copyright (C) Lee Goddard, 2011. All Rights Reserved.
Made available under the same terms as Perl.