jeffw_00 has asked for the wisdom of the Perl Monks concerning the following question:
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: get() from website hangs
by Corion (Patriarch) on Sep 13, 2019 at 12:52 UTC | |
Re: get() from website hangs
by Fletch (Bishop) on Sep 13, 2019 at 12:50 UTC | |
Re: get() from website hangs
by bliako (Abbot) on Sep 17, 2019 at 21:41 UTC | |
Re: get() from website hangs
by jeffw_00 (Novice) on Sep 13, 2019 at 15:48 UTC | |
by FreeBeerReekingMonk (Deacon) on Sep 17, 2019 at 20:03 UTC | |
Re: get() from website hangs
by harangzsolt33 (Deacon) on Sep 14, 2019 at 01:26 UTC | |
by trwww (Priest) on Sep 14, 2019 at 01:42 UTC | |
by jcb (Parson) on Sep 14, 2019 at 21:40 UTC |