http://qs321.pair.com?node_id=144945

jonjacobmoon has asked for the wisdom of the Perl Monks concerning the following question:

Okay, I am using Text::Ispell and coming across what may be a bug, but I want to try the code, catch it, and handle it without quitting prematurely. Lovers and users hate it when you quit prematurely.

Anyway...... Here is my code (or at least part of it):

# add words to the dictionary, if desired by the user foreach (@misses) { # logging only, not adding any words to dictionary if option s +et unless ($opts{terse}) { unless ($noRepAdds{$_}) { print "Do you wish to add [ $_ ] to the directory [ y|n ]? + "; $add = <STDIN>; chomp($add); if ($add eq 'y') { add_word($_); if ($!) { # this does print print "ERROR: $!\n"; } save_dictionary(); print "adding word: $_\n"; $noRepAdds{$_}++; } } } }

When I run across a problem adding to the dictionary, I get an error reflected in $! and then when I go to add another word, the program quits with the following message:

Do you wish to add nis2002 to the directory? y adding word: nis2002 Do you wish to add nbsp to the directory? Invalid word "nis2002": The +character '2' may not appear at the middle of a word. y Broken pipe

First, off ispell on the command line has no problem with nis2002 nor should it according to the documentation, so my guess is the Text::Ispell has a bug in it, although I could not find it. Still, there has to be a way to try and catch this exception.

Any ideas would be most helpful, I have been struggling with this minor bug for three days with no end in sight.


I admit it, I am Paco.

Edit by tye to change PRE to CODE around long lines