Hi - the relevant lines of my script are

------- use LWP::Simple; $pass=1; my $doc = get('http://forecast.weather.gov/MapClick.php?CityName=Sudbu +ry&state=MA&site=BOX&lat=42.3667&lon=-71.4') || die {$pass=0}; -------

This is part of a script that runs every 15 minutes that gets this webpage, parses some specific info from it (like temperature), and writes the info to a file so my home control program can later open the file and act on the data. My problem is that a few times a day, the get never returns, and the script hangs. I have another script running that detects the hang, and kills and restarts the script. But that's clunky. I'd like to either eliminate the hang, or detect the hang -within- the script. But that is a level of Perl that I haven't dealt with before so I'm wondering if anyone can point me to a recipe. Thanks!

Further background - using ActivePerl on a W7 machine this code never hung. Switched to W10 and ActivePerl stopped supporting the get properly so I switched to Strawberry Perl (which i like better overall) but where I am having this intermittent issue. (this is probably the "fanciest" thing I do with Perl on my PC so for everything else either Perl works fine).

Many Thanks!
/j


In reply to get() from website hangs by jeffw_00

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.