So, it is always possible that something in your data is causing trouble. You might try to figure out what is on line 370 of your INFO file, and show it to us. One thing about your code that makes me nervous is that you are rather trusting and don't seem to use ref() to check if $resultpair or $leo->en_de are array references before you cast them to arrays. Personally, I like to make sure of things like that.

Also, you check $leo->num_results, where you ought to be checking the return from $leo->query(). Looking at the source code for WWW-LEO I see that num_results is set in _parse_response, yet that method is only called if the query is successful. For an unsuccessful query, you'll get the num_results value from the last query, which probably isn't what you want.

I haven't used this module, so please take my comments with several tablespoons of salt. :)

Update: Sigh, I should look at the code more carefully. Note that inside the query method, there is a call to reset, which sets num_results to zero. Please scratch that last remark.


No good deed goes unpunished. -- (attributed to) Oscar Wilde

In reply to Re: WWW-LEO, why is my code "crashing" by ptum
in thread WWW-LEO, why is my code "crashing" by metalfan

Title:
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, 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:
    & &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.