[Bps-public-commit] Test-Spelling branch, master, updated. a8030735832129460f998ac8ae36a9d38c5b07b9

Shawn Moore sartak at bestpractical.com
Mon Apr 25 17:10:59 EDT 2011


The branch, master has been updated
       via  a8030735832129460f998ac8ae36a9d38c5b07b9 (commit)
       via  fa7192a0764ef25b3160d06760a7da505ebee080 (commit)
       via  0a6badbffadecb5d75a2f0e53761772d2bae0d2e (commit)
       via  395b100b73310f5cc2234d032eaec6be8a942406 (commit)
       via  0692fe9319ccd4744fb45e2acc8ebe5d395d33ca (commit)
       via  6b513f71f2db3d590cd25ee171da82ac9436cedd (commit)
       via  85da2b6f61f387ea089478932df08fb4e63aa0fa (commit)
      from  9a30b0c853a5032176b9d4df7a7d8d3f5beb9452 (commit)

Summary of changes:
 Changes              |   18 ++++-
 Makefile.PL          |    2 -
 README               |  180 +++++++++++++++++++++++++++++++++----------
 lib/Test/Spelling.pm |  211 ++++++++++++++++++++++++++++----------------------
 4 files changed, 272 insertions(+), 139 deletions(-)

- Log -----------------------------------------------------------------
commit 85da2b6f61f387ea089478932df08fb4e63aa0fa
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Apr 25 15:20:29 2011 -0400

    has_working_spellchecker and skip_all if there is none

diff --git a/lib/Test/Spelling.pm b/lib/Test/Spelling.pm
index 28bcd18..6a045ca 100644
--- a/lib/Test/Spelling.pm
+++ b/lib/Test/Spelling.pm
@@ -18,6 +18,7 @@ our @EXPORT = qw(
     set_spell_cmd
     all_pod_files
     set_pod_file_filter
+    has_working_spellchecker
 );
 
 my $Test = Test::Builder->new;
@@ -37,8 +38,19 @@ sub spellchecker_candidates {
     );
 }
 
+sub has_working_spellchecker {
+    my $dryrun_results = _get_spellcheck_results("dry run", 1);
+
+    if (ref $dryrun_results) {
+        return;
+    }
+
+    return $SPELLCHECKER;
+}
+
 sub _get_spellcheck_results {
     my $document = shift;
+    my $dryrun = shift;
 
     my @errors;
 
@@ -63,7 +75,8 @@ sub _get_spellcheck_results {
         if ($ok) {
             # remember the one we used, so that it's consistent for all the files
             # this run, and we don't keep retrying the same spellcheckers that will
-            # never work
+            # never work. also we need to expose the spellchecker we're using in
+            # has_working_spellchecker
             set_spell_cmd($spellchecker)
                 if !$SPELLCHECKER;
             return @words;
@@ -72,6 +85,9 @@ sub _get_spellcheck_results {
         push @errors, "Unable to run '$spellchecker': $@";
     }
 
+    # no working spellcheckers during a dry run
+    return \"no spellchecker" if $dryrun;
+
     # no working spellcheckers; report all the errors
     require Carp;
     Carp::croak
@@ -85,7 +101,7 @@ sub invalid_words_in {
     my $document = '';
     open my $handle, '>', \$document;
 
-    # save digested POD to temp file
+    # save digested POD to the string $document
     my $checker = Pod::Spell->new;
     $checker->parse_from_file($file, $handle);
 
@@ -126,6 +142,10 @@ sub pod_file_spelling_ok {
 sub all_pod_files_spelling_ok {
     my @files = all_pod_files(@_);
 
+    if (!has_working_spellchecker()) {
+        return $Test->plan(skip_all => "no working spellchecker found");
+    }
+
     $Test->plan(tests => scalar @files);
 
     my $ok = 1;

commit 6b513f71f2db3d590cd25ee171da82ac9436cedd
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Apr 25 16:05:29 2011 -0400

    Take a pass at improving the entire documentation
    
        I don't plan to continue supporting "perl t/spell.t 2>> t/spell.t",
        since that limits the diagnostic output, as well as the format of
        the stopwords DATA sections, pretty rigidly.

diff --git a/lib/Test/Spelling.pm b/lib/Test/Spelling.pm
index 6a045ca..96b5ecc 100644
--- a/lib/Test/Spelling.pm
+++ b/lib/Test/Spelling.pm
@@ -207,6 +207,9 @@ sub _is_perl {
 
 sub add_stopwords {
     for my $word (@_) {
+        # XXX: the processing this performs is to support "perl t/spell.t 2>>
+        # t/spell.t" which is bunk. in the near future the processing here will
+        # become more modern
         $word =~ s/^#?\s*//;
         $word =~ s/\s+$//;
         next if $word =~ /\s/ or $word =~ /:/;
@@ -232,82 +235,102 @@ Test::Spelling - check for spelling errors in POD files
 
 =head1 SYNOPSIS
 
-C<Test::Spelling> lets you check the spelling of a POD file, and report
-its results in standard C<Test::Simple> fashion. This module requires the
-F<spell> program.
-
     use Test::More;
-    use Test::Spelling;
-    plan tests => $num_tests;
-    pod_file_spelling_ok($file, "POD file spelling OK");
-
-Module authors can include the following in a F<t/pod_spell.t> file and
-have C<Test::Spelling> automatically find and check all POD files in a
-module distribution:
+    BEGIN {
+        plan skip_all => "Spelling tests only for authors"
+            unless -d 'inc/.author';
+    }
 
-    use Test::More;
     use Test::Spelling;
     all_pod_files_spelling_ok();
 
-Note, however that it is not really recommended to include this test with a
-CPAN distribution, or a package that will run in an uncontrolled environment,
-because there's no way of predicting if F<spell> will be available or the
-word list used will give the same results (what if it's in a different language,
-for example?). You can have the test, but don't add it to F<MANIFEST> (or add
-it to F<MANIFEST.SKIP> to make sure you don't add it by accident). Anyway,
-your users don't really need to run this test, as it is unlikely that the
-documentation will acquire typos while in transit. :-)
+=head1 DESCRIPTION
 
-You can add your own stopwords (words that should be ignored by the spell
-check):
+C<Test::Spelling> lets you check the spelling of a POD file, and report
+its results in standard C<Test::More> fashion. This module requires a
+spellcheck program such as F<spell>, F<aspell>, F<ispell>, or F<hunspell>.
 
-    add_stopwords(qw(asdf thiswordiscorrect));
+    use Test::Spelling;
+    pod_file_spelling_ok('lib/Foo/Bar.pm', 'POD file spelling OK');
 
-These stopwords are global for the test. See L<Pod::Spell> for a variety of
-ways to add per-file stopwords to each .pm file.
+Note that it is a bad idea to run spelling tests during an ordinary CPAN
+distribution install, or in a package that will run in an uncontrolled
+environment. There is no way of predicting whether the word list or spellcheck
+program used will give the same results. You B<can> include the test in your
+distribution, but be sure to run it only for authors of the module by guarding
+it in a C<skip_all unless -d 'inc/.author'> clause, or by putting the test in
+your distribution's F<xt/> directory. Anyway, people installing your module
+really do not need to run such tests, as it is unlikely that the documentation
+will acquire typos while in transit. :-)
 
-=head1 DESCRIPTION
+You can add your own stopwords, which are words that should be ignored by the
+spell check, like so:
 
-Check POD files for spelling mistakes, using L<Pod::Spell> and F<spell> to do
-the heavy lifting.
+    add_stopwords(qw(asdf thiswordiscorrect));
 
-=head1 FUNCTIONS
+Adding stopwards in this fashion affects all files checked for the remainder of
+the test script. See L<Pod::Spell> (which this module is built upon) for a
+variety of ways to add per-file stopwords to each .pm file.
 
-=head2 pod_file_spelling_ok( FILENAME[, TESTNAME ] )
+If you have a lot of stopwords, it's useful to put them in your test file's
+C<DATA> section like so:
 
-C<pod_file_spelling_ok()> will okay the test if the POD has no spelling errors.
+    use Test::Spelling;
+    add_stopwords(<DATA>);
+    all_pod_files_spelling_ok();
 
-When it fails, C<pod_file_spelling_ok()> will show any spelling errors as
-diagnostics.
+    __END__
+    folksonomy
+    Jifty
+    Zakirov
 
-The optional second argument TESTNAME is the name of the test.  If it
-is omitted, C<pod_file_spelling_ok()> chooses a default test name "POD spelling
-for FILENAME".
+To maintain backwards compatibility, comment markers and some whitespace are
+ignored. In the near future, the preprocessing we do on the arguments to
+L<add_stopwords> will be changed and documented properly.
+
+=head1 FUNCTIONS
 
 =head2 all_pod_files_spelling_ok( [@files/@directories] )
 
-Checks all the files in C<@files> for POD spelling.  It runs L<all_pod_files()>
-on each file/directory, and calls the C<plan()> function for you (one test for
-each function), so you can't have already called C<plan>.
+Checks all the files for POD spelling. It gathers L<all_pod_files()> on each
+file/directory, and declares a L<Test::More/plan> for you (one test for each
+file), so you must not call C<plan> yourself.
 
-If C<@files> is empty or not passed, the function finds all POD files in
-the F<blib> directory if it exists, or the F<lib> directory if not.
-A POD file is one that ends with F<.pod>, F<.pl>, F<.plx>, or F<.pm>; or any
-file where the first line looks like a shebang line.
+If C<@files> is empty, the function finds all POD files in the F<blib>
+directory if it exists, or the F<lib> directory if it does not. A POD file is
+one that ends with F<.pod>, F<.pl>, F<.plx>, or F<.pm>; or any file where the
+first line looks like a perl shebang line.
 
-If you're testing a module, just make a F<t/spell.t>:
+If there is no working spellchecker (determined by
+L</has_working_spellchecker>), this test will issue a "skip all" directive.
+
+If you're testing a distribution, just create a F<t/pod-spell.t>:
 
     use Test::More;
+    plan skip_all => "Spelling tests only for authors" unless -d "inc/.author";
     use Test::Spelling;
     all_pod_files_spelling_ok();
 
-Returns true if all pod files are ok, or false if any fail.
+Returns true if every POD file has correct spelling, or false if any of them fail.
+This function will show any spelling errors as diagnostics.
+
+=head2 pod_file_spelling_ok( FILENAME[, TESTNAME ] )
+
+C<pod_file_spelling_ok> will test that the given POD file has no spelling
+errors.
+
+When it fails, C<pod_file_spelling_ok> will show any spelling errors as
+diagnostics.
+
+The optional second argument TESTNAME is the name of the test.  If it
+is omitted, C<pod_file_spelling_ok> chooses a default test name "POD spelling
+for FILENAME".
 
 =head2 all_pod_files( [@dirs] )
 
-Returns a list of all the Perl files in I<$dir> and in directories below.
-If no directories are passed, it defaults to F<blib> if F<blib> exists,
-or else F<lib> if not.  Skips any files in CVS or .svn directories.
+Returns a list of all the Perl files in each directory and its subdirectories,
+recursively. If no directories are passed, it defaults to F<blib> if F<blib>
+exists, or else F<lib> if not. Skips any files in F<CVS> or F<.svn> directories.
 
 A Perl file is:
 
@@ -320,50 +343,34 @@ A Perl file is:
 =back
 
 Furthermore, files for which the filter set by L</set_pod_file_filter> return
-false are skipped. By default this filter passes everything through.
+false are skipped. By default, this filter passes everything through.
 
 The order of the files returned is machine-dependent.  If you want them
 sorted, you'll have to sort them yourself.
 
 =head2 add_stopwords(@words)
 
-Add words that should be skipped by the spell check. A suggested use is to list
-these words, one per line, in the __DATA__ section of your test file, and just
-call
-
-    add_stopwords(<DATA>);
-
-As a convenience, C<add_stopwords> will automatically ignore a comment mark and
-one or more spaces from the beginning of the line, and it will ignore lines
-that say '# Error:' or '# Looks like' or /Failed test/. The reason? Let's say
-you run a test and get this result:
-
-    1..1
-    not ok 1 - POD spelling for lib/Test/Spelling.pm
-    #     Failed test (lib/Test/Spelling.pm at line 70)
-    # Errors:
-    #     stopwords
-    # Looks like you failed 1 tests of 1.
-
-Let's say you decide that all the words that were marked as errors are really
-correct. The diagnostic lines are printed to STDERR; that means that, if you
-have a decent shell, you can type something like
-
-    perl t/spell.t 2>> t/spell.t
+Add words that should be skipped by the spellcheck. Note that L<Pod::Spell>
+already skips words believed to be code, such as everything in verbatim
+(indented) blocks and code marked up with C<< C<...> >>, as well as some common
+Perl jargon.
 
-which will append the diagnostic lines to the end of your test file. Assuming
-you already have a __DATA__ line in your test file, that should be enough to
-ensure that the test passes the next time.
+=head2 has_working_spellchecker
 
-Also note that L<Pod::Spell> skips words believed to be code, such as words
-in verbatim blocks and code labeled with CE<lt>>.
+C<has_working_spellchecker> will return C<undef> if there is no working
+spellchecker, or a true value (the spellchecker command itself) if there is.
+The module performs a dry-run to determine whether any of the spellcheckers it
+can will use work on the current system. You can use this to skip tests if
+there is no spellchecker. Note that L</all_pod_files_spelling_ok> will do this
+for you.
 
 =head2 set_spell_cmd($command)
 
-If the F<spell> program has a different name or is not in your path, you can
-specify an alternative with C<set_spell_cmd>. Any command that takes text
-from standard input and prints a list of misspelled words, one per line, to
-standard output will do. For example, you can use C<aspell list>.
+If you want to force this module to use a particular spellchecker, then you can
+specify which one with C<set_spell_cmd>. This is useful to ensure a more
+consistent lexicon between developers, or if you have an unusual environment.
+Any command that takes text from standard input and prints a list of misspelled
+words, one per line, to standard output will do.
 
 =head2 set_pod_file_filter($code)
 

commit 0692fe9319ccd4744fb45e2acc8ebe5d395d33ca
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Apr 25 16:16:56 2011 -0400

    Regenerate README from perldoc -tT

diff --git a/README b/README
index b80a4ae..7bca4c5 100644
--- a/README
+++ b/README
@@ -1,64 +1,162 @@
-Test::Spelling version 0.11
-===========================
+NAME
+    Test::Spelling - check for spelling errors in POD files
 
+SYNOPSIS
+        use Test::More;
+        BEGIN {
+            plan skip_all => "Spelling tests only for authors"
+                unless -d 'inc/.author';
+        }
+
+        use Test::Spelling;
+        all_pod_files_spelling_ok();
+
+DESCRIPTION
     "Test::Spelling" lets you check the spelling of a POD file, and report
-    its results in standard "Test::Simple" fashion. This module requires the
-    spell program.
+    its results in standard "Test::More" fashion. This module requires a
+    spellcheck program such as spell, aspell, ispell, or hunspell.
+
+        use Test::Spelling;
+        pod_file_spelling_ok('lib/Foo/Bar.pm', 'POD file spelling OK');
+
+    Note that it is a bad idea to run spelling tests during an ordinary CPAN
+    distribution install, or in a package that will run in an uncontrolled
+    environment. There is no way of predicting whether the word list or
+    spellcheck program used will give the same results. You can include the
+    test in your distribution, but be sure to run it only for authors of the
+    module by guarding it in a "skip_all unless -d 'inc/.author'" clause, or
+    by putting the test in your distribution's xt/ directory. Anyway, people
+    installing your module really do not need to run such tests, as it is
+    unlikely that the documentation will acquire typos while in transit. :-)
+
+    You can add your own stopwords, which are words that should be ignored
+    by the spell check, like so:
+
+        add_stopwords(qw(asdf thiswordiscorrect));
+
+    Adding stopwards in this fashion affects all files checked for the
+    remainder of the test script. See Pod::Spell (which this module is built
+    upon) for a variety of ways to add per-file stopwords to each .pm file.
+
+    If you have a lot of stopwords, it's useful to put them in your test
+    file's "DATA" section like so:
 
-        use Test::More;
         use Test::Spelling;
-        plan tests => $num_tests;
-        pod_file_spelling_ok( $file, "POD file spelling OK" );
+        add_stopwords(<DATA>);
+        all_pod_files_spelling_ok();
 
-    Module authors can include the following in a t/pod_spell.t file and
-    have "Test::Spelling" automatically find and check all POD files in a
-    module distribution:
+        __END__
+        folksonomy
+        Jifty
+        Zakirov
+
+    To maintain backwards compatibility, comment markers and some whitespace
+    are ignored. In the near future, the preprocessing we do on the
+    arguments to add_stopwords will be changed and documented properly.
+
+FUNCTIONS
+  all_pod_files_spelling_ok( [@files/@directories] )
+    Checks all the files for POD spelling. It gathers all_pod_files() on
+    each file/directory, and declares a "plan" in Test::More for you (one
+    test for each file), so you must not call "plan" yourself.
+
+    If @files is empty, the function finds all POD files in the blib
+    directory if it exists, or the lib directory if it does not. A POD file
+    is one that ends with .pod, .pl, .plx, or .pm; or any file where the
+    first line looks like a perl shebang line.
+
+    If there is no working spellchecker (determined by
+    "has_working_spellchecker"), this test will issue a "skip all"
+    directive.
+
+    If you're testing a distribution, just create a t/pod-spell.t:
 
         use Test::More;
+        plan skip_all => "Spelling tests only for authors" unless -d "inc/.author";
         use Test::Spelling;
         all_pod_files_spelling_ok();
 
-    Note, however that it is not really recommended to include this test
-    with a CPAN distribution, or a package that will run in an uncontrolled
-    environment, because there's no way of predicting if spell will be
-    available or the wordlist used will give the same results (what if it's
-    in a different language, for example?).
+    Returns true if every POD file has correct spelling, or false if any of
+    them fail. This function will show any spelling errors as diagnostics.
+
+  pod_file_spelling_ok( FILENAME[, TESTNAME ] )
+    "pod_file_spelling_ok" will test that the given POD file has no spelling
+    errors.
+
+    When it fails, "pod_file_spelling_ok" will show any spelling errors as
+    diagnostics.
+
+    The optional second argument TESTNAME is the name of the test. If it is
+    omitted, "pod_file_spelling_ok" chooses a default test name "POD
+    spelling for FILENAME".
+
+  all_pod_files( [@dirs] )
+    Returns a list of all the Perl files in each directory and its
+    subdirectories, recursively. If no directories are passed, it defaults
+    to blib if blib exists, or else lib if not. Skips any files in CVS or
+    .svn directories.
+
+    A Perl file is:
+
+    *   Any file that ends in .PL, .pl, .plx, .pm, .pod or .t.
+
+    *   Any file that has a first line with a shebang and "perl" on it.
+
+    Furthermore, files for which the filter set by "set_pod_file_filter"
+    return false are skipped. By default, this filter passes everything
+    through.
 
-    You can add your own stopwords (words that should be ignored by the
-    spell check):
+    The order of the files returned is machine-dependent. If you want them
+    sorted, you'll have to sort them yourself.
 
-        add_stopwords(qw(adsf thiswordiscorrect));
+  add_stopwords(@words)
+    Add words that should be skipped by the spellcheck. Note that Pod::Spell
+    already skips words believed to be code, such as everything in verbatim
+    (indented) blocks and code marked up with "...", as well as some common
+    Perl jargon.
 
-    These stopwords are global for the test. See L<Pod::Spell> for a variety of
-    ways to add per-file stopwords to each .pm file.
+  has_working_spellchecker
+    "has_working_spellchecker" will return "undef" if there is no working
+    spellchecker, or a true value (the spellchecker command itself) if there
+    is. The module performs a dry-run to determine whether any of the
+    spellcheckers it can will use work on the current system. You can use
+    this to skip tests if there is no spellchecker. Note that
+    "all_pod_files_spelling_ok" will do this for you.
 
-CHANGES SINCE VERSION 0.10
-        - Some documentation fixes.
-        - Added note about per-file stopwords by Chris Dolan.
-        - Use a temporary file instead of open2() to solve win32 portability
-          issues. (Thanks to Chris Laco!)
+  set_spell_cmd($command)
+    If you want to force this module to use a particular spellchecker, then
+    you can specify which one with "set_spell_cmd". This is useful to ensure
+    a more consistent lexicon between developers, or if you have an unusual
+    environment. Any command that takes text from standard input and prints
+    a list of misspelled words, one per line, to standard output will do.
 
-INSTALLATION
+  set_pod_file_filter($code)
+    If your project has POD documents written in languages other than
+    English, then obviously you don't want to be running a spellchecker on
+    every Perl file. "set_pod_file_filter" lets you filter out files
+    returned from "all_pod_files" (and hence, the documents tested by
+    "all_pod_files_spelling_ok").
 
-    perl Makefile.PL
-    make
-    make test
-    make install
+        set_pod_file_filter(sub {
+            my $filename = shift;
+            return 0 if $filename =~ /_ja.pod$/; # skip Japanese translations
+            return 1;
+        });
 
+SEE ALSO
+    Pod::Spell
 
-DEPENDENCIES
-        perl-5.6.0+
-        Pod::Spell              1.01
-        Test::More              0
-        Test::Builder::Tester   0
-        File::Spec              0
-        File::Temp              0
+ORIGINAL AUTHOR
+    Ivan Tubert-Brohman "<itub at cpan.org>"
 
+    Heavily based on Test::Pod by Andy Lester and brian d foy.
 
-COPYRIGHT AND LICENSE
+MAINTAINER
+    Shawn M Moore "<sartak at bestpractical.com>"
 
-Copyright (C) 2005 Ivan Tubert-Brohman <itub at cpan.org>
+COPYRIGHT
+    Copyright 2005, Ivan Tubert-Brohman, All Rights Reserved.
 
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself. 
+    You may use, modify, and distribute this package under the same terms as
+    Perl itself.
 

commit 395b100b73310f5cc2234d032eaec6be8a942406
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Apr 25 16:24:55 2011 -0400

    Changes

diff --git a/Changes b/Changes
index 768b0b4..3bb1e92 100644
--- a/Changes
+++ b/Changes
@@ -2,14 +2,24 @@ Revision history for Test-Spelling
 
 0.12  2011-04-25
         - Best Practical has taken over maintainership of this module
-        - Clean up temporary files more aggressively [rt.cpan.org #41586]
+        - Try various spellcheck programs instead of hardcoding the ancient
+          `spell` [rt.cpan.org #56483] (reported by Lars Dɪᴇᴄᴋᴏᴡ, et al)
+        - Remove temporary files more aggressively [rt.cpan.org #41586]
           (reported by Tokuhiro Matsuno)
-        - Correct aspell suggestion from -l to list [rt.cpan.org #28967]
+          - fixed by not creating them at all :) instead we now use IPC::Open3
+        - Remove suggestion to use broken `aspell -l` [rt.cpan.org #28967]
           (reported by David Hand)
         - Add set_pod_file_filter for skipping translations, etc.
           [rt.cpan.org #63755] (reported by me :))
-        - Try various spellcheck programs [rt.cpan.org #56483] (reported by
-          Lars Dɪᴇᴄᴋᴏᴡ, et al)
+        - Skip tests in all_pod_files_spelling_ok if there is no working
+          spellchecker
+        - Provide a has_working_spellchecker so you can skip your own tests if
+          there's no working spellchecker
+        - Switch to Module::Install
+        - Rewrite and modernize a lot of the documentation
+        - Decruftify code, such as by using Exporter and lexical filehandles
+        - Support .plx files (you're welcome Schwern)
+
 
 0.11  2005-11-15
         - Some documentation fixes.

commit 0a6badbffadecb5d75a2f0e53761772d2bae0d2e
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Apr 25 16:25:13 2011 -0400

    $FILE_FILTER is a "global" so uppercase it

diff --git a/lib/Test/Spelling.pm b/lib/Test/Spelling.pm
index 96b5ecc..c53524e 100644
--- a/lib/Test/Spelling.pm
+++ b/lib/Test/Spelling.pm
@@ -24,7 +24,7 @@ our @EXPORT = qw(
 my $Test = Test::Builder->new;
 
 my $SPELLCHECKER;
-my $file_filter = sub { 1 };
+my $FILE_FILTER = sub { 1 };
 
 sub spellchecker_candidates {
     # if they've specified a spellchecker, use only that one
@@ -177,7 +177,7 @@ sub all_pod_files {
         # add the file if it meets our criteria
         if (-f $file) {
             next unless _is_perl($file);
-            next unless $file_filter->($file);
+            next unless $FILE_FILTER->($file);
             push @pod, $file;
         }
     }
@@ -222,7 +222,7 @@ sub set_spell_cmd {
 }
 
 sub set_pod_file_filter {
-    $file_filter = shift;
+    $FILE_FILTER = shift;
 }
 
 1;

commit fa7192a0764ef25b3160d06760a7da505ebee080
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Apr 25 16:25:53 2011 -0400

    Don't even bother declaring a dep on Test::More

diff --git a/Makefile.PL b/Makefile.PL
index fc61b9c..b431cf7 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,7 +6,5 @@ repository 'http://github.com/bestpractical/test-spelling';
 
 requires 'Pod::Spell' => '1.01';
 
-test_requires 'Test::More' => 0;
-
 WriteAll;
 

commit a8030735832129460f998ac8ae36a9d38c5b07b9
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Apr 25 16:27:55 2011 -0400

    $TEST is global too

diff --git a/lib/Test/Spelling.pm b/lib/Test/Spelling.pm
index c53524e..2aef21a 100644
--- a/lib/Test/Spelling.pm
+++ b/lib/Test/Spelling.pm
@@ -21,7 +21,7 @@ our @EXPORT = qw(
     has_working_spellchecker
 );
 
-my $Test = Test::Builder->new;
+my $TEST = Test::Builder->new;
 
 my $SPELLCHECKER;
 my $FILE_FILTER = sub { 1 };
@@ -116,8 +116,8 @@ sub pod_file_spelling_ok {
     my $name = shift || "POD spelling for $file";
 
     if (!-r $file) {
-        $Test->ok(0, $name);
-        $Test->diag("$file does not exist or is unreadable");
+        $TEST->ok(0, $name);
+        $TEST->diag("$file does not exist or is unreadable");
         return;
     }
 
@@ -131,9 +131,9 @@ sub pod_file_spelling_ok {
 
     # emit output
     my $ok = @words == 0;
-    $Test->ok($ok, "$name");
+    $TEST->ok($ok, "$name");
     if (!$ok) {
-        $Test->diag("Errors:\n" . join '', map { "    $_\n" } @words);
+        $TEST->diag("Errors:\n" . join '', map { "    $_\n" } @words);
     }
 
     return $ok;
@@ -143,10 +143,10 @@ sub all_pod_files_spelling_ok {
     my @files = all_pod_files(@_);
 
     if (!has_working_spellchecker()) {
-        return $Test->plan(skip_all => "no working spellchecker found");
+        return $TEST->plan(skip_all => "no working spellchecker found");
     }
 
-    $Test->plan(tests => scalar @files);
+    $TEST->plan(tests => scalar @files);
 
     my $ok = 1;
     for my $file (@files) {

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list