Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

In reply to Ispell did it in my code with a broken pipe, anyone got a clue? by jonjacobmoon

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (5)
    As of 2020-11-25 03:21 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found