[Bps-public-commit] Test-Spelling branch, master, updated. 0.12-2-gd95d337
Shawn Moore
sartak at bestpractical.com
Wed Apr 27 13:31:21 EDT 2011
The branch, master has been updated
via d95d3378a47e6dead2dcc54ddc255bf9cf01ac58 (commit)
from 24a74b4886530ab67684c67fb759cf36f8776da2 (commit)
Summary of changes:
Changes | 5 ++++-
lib/Test/Spelling.pm | 12 +++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit d95d3378a47e6dead2dcc54ddc255bf9cf01ac58
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Wed Apr 27 13:31:10 2011 -0400
Make alternatives checking more robust by reading the spellchecker's STDERR
diff --git a/Changes b/Changes
index 3bb1e92..542bc1c 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
Revision history for Test-Spelling
+0.13 2011-04-27
+ - Make alternatives checking more robust by reading the spellchecker's
+ STDERR
+
0.12 2011-04-25
- Best Practical has taken over maintainership of this module
- Try various spellcheck programs instead of hardcoding the ancient
@@ -20,7 +24,6 @@ Revision history for Test-Spelling
- 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.
- Added note about per-file stopwords by Chris Dolan.
diff --git a/lib/Test/Spelling.pm b/lib/Test/Spelling.pm
index 748d050..615dbc2 100644
--- a/lib/Test/Spelling.pm
+++ b/lib/Test/Spelling.pm
@@ -8,6 +8,7 @@ use Pod::Spell;
use Test::Builder;
use File::Spec;
use IPC::Open3;
+use Symbol 'gensym';
our $VERSION = '0.12';
@@ -57,7 +58,13 @@ sub _get_spellcheck_results {
for my $spellchecker (spellchecker_candidates()) {
my @words;
my $ok = eval {
- my $pid = open3((my ($child_in, $spellcheck_results, $child_err)), $spellchecker);
+ # IPC::Open3 says "If CHLD_ERR is false [...] then STDOUT and
+ # STDERR of the child are on the same filehandle (this means that
+ # an autovivified lexical cannot be used for the STDERR
+ # filehandle [...])" - what a crummy API!
+ my $child_error = gensym;
+
+ my $pid = open3(my ($child_in, $spellcheck_results), $child_error, $spellchecker);
print $child_in $document;
@@ -66,6 +73,9 @@ sub _get_spellcheck_results {
@words = <$spellcheck_results>;
+ my $errors = do { local $/; <$child_error> };
+ die "spellchecker had errors: $errors" if length $errors;
+
# wait for spellchecker to clean up
waitpid $pid, 0;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list