Let's say I have this dummy Perl package in test.pm
:
package test;
use strict;
use warnings;
=head1 DESCRIPTION
=head2 env
Return the environment name.
=cut
sub env { return "environment name"; }
=head2 hst
Return the history file name.
=cut
sub hst { return "history file"; }
=head2 hst_dir
Return the directory containing the history file.
=cut
sub hst_dir { return "history directory"; }
1;
Then, I run a spell check from command line using Test::Spelling
...
$ perl -MTest::More -MTest::Spelling \
> -e 'pod_file_spelling_ok("test.pm", "spell check"); done_testing;'
..., and my function names env
and hst
are marked as a typos, but hst_dir
is accepted:
not ok 1 - spell check
# Failed test 'spell check'
# at -e line 1.
# Errors:
# env
# hst
1..1
# Looks like you failed 1 test of 1.
I know I can list a custom dictionary with add_stopwords()
, but in my opinion function names should not be spell-checked at all.
Did I miss some fine-print in the documentation?
You're spell-cheking your POD, not your code.
Test::Spelling
sees:
=head2 env
=head2 hst
How would it know that that are function names (not that it knows the concept of function names at all)?
It does see hst_dir as a perlish keyword, due to the underscore, whixh is not a normal character in a word. But that's as best it gets without stop words...