Subject: | pod_file_spelling_ok hangs on win32 |
Running tests that call pod_file_spelling_ok causes the tests to hang on Windows XP, and possibly other win32 platforms. This can be traced to the open2 call to read and write from aspell.
The following patch is a safer work around for trying to use open2 predictably under win32. The patch creates a temp file using File::Temp. Pod::Spell->parse_from_file reads the original file and writes the pod to be spell checked into the temp file. We then call open against the pipe output created by calling "$spellcmd < $tempfile|"; giving us the mispelled words.
--- Spelling.pm.orig Tue Aug 02 22:30:36 2005
+++ Spelling.pm Tue Nov 15 16:15:00 2005
@@ -5,12 +5,13 @@
use Pod::Spell;
use Test::Builder;
use File::Spec;
-use IPC::Open2;
+use File::Temp;
our $VERSION = '0.10';
my $Test = Test::Builder->new;
my $Spell_cmd = 'spell';
+my $Spell_temp = File::Temp->new->filename;
sub import {
my $self = shift;
@@ -39,13 +40,13 @@
}
my $checker = Pod::Spell->new;
- my($fh_in, $fh_out);
- my $pid = open2($fh_in, $fh_out, $Spell_cmd);
+ $checker->parse_from_file($file, $Spell_temp);
- $checker->parse_from_file($file, $fh_out);
- close $fh_out or die;
- my @words = <$fh_in>;
- close $fh_in or die;
+ open ASPELL, "$Spell_cmd < $Spell_temp|";
+
+ my @words = <ASPELL>;
+
+ close ASPELL;
chomp for @words;
@words = grep { !$Pod::Wordlist::Wordlist{$_} } @words;