This sounds like a problem I'm having with both the Lingua::ISpell and Text::ISpell modules. Every script I write with them just hangs when an attempt is made to read from the spawned process's output pipe. Both modules use an open2 call from an _init() function prior to calling spellcheck(). Here's what they look like:
sub _init {
...
$Lingua::Ispell::pid = open2(
*Reader,
*Writer,
$Lingua::Ispell::path,
'-a', '-S',
@options,
);
...
}
sub spellcheck {
_init() or return(); # caller should really catch the exception fro
+m a failed open2.
my $line = shift;
local $/ = "\n"; local $\ = '';
chomp $line;
$line =~ s/\r//g; # kill the hate
$line =~ /\n/ and croak "newlines not allowed in arguments to Lingua
+::Ispell::spellcheck!";
print Writer "^$line\n";
my @commentary;
local $_;
while ( <Reader> ) {
chomp;
last unless $_ gt '';
push @commentary, $_;
}
From a debugger, I see that it hangs at the line:
while ( <Reader> ) {
By the by, I'm trying to write a litte script to check fields in a database for spelling errors and write out a log of misspelled words.
Any ideas on what I'm doing wrong?
( I can't even run the example code for these modules without hanging. Oh, I'm on a Windows machine and cannot use a real operating system.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.