mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
added: error handling for missing LWP::ua to avoid fhem crash
git-svn-id: https://svn.fhem.de/fhem/trunk@5058 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
4f5074bec4
commit
a701b835a2
@ -36,7 +36,7 @@ use Net::FTP;
|
|||||||
use List::MoreUtils 'first_index';
|
use List::MoreUtils 'first_index';
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
use HttpUtils;
|
use HttpUtils;
|
||||||
require LWP::UserAgent;
|
#require LWP::UserAgent;
|
||||||
|
|
||||||
my ($bulaList, $cmapList, %rmapList, $fmapList, %bula2bulaShort, %bulaShort2dwd, %dwd2Dir, %dwd2Name,
|
my ($bulaList, $cmapList, %rmapList, $fmapList, %bula2bulaShort, %bulaShort2dwd, %dwd2Dir, %dwd2Name,
|
||||||
$alertsXml, %capCityHash, %capCellHash, $sList, $aList);
|
$alertsXml, %capCityHash, %capCellHash, $sList, $aList);
|
||||||
@ -699,9 +699,17 @@ sub retrieveFile($$;$$$){
|
|||||||
my ($dwd, $dir, $ftp, @files, $dataFile, $targetFile, $found, $readingName);
|
my ($dwd, $dir, $ftp, @files, $dataFile, $targetFile, $found, $readingName);
|
||||||
|
|
||||||
my $urlString = "ftp://$user:$pass\@ftp-outgoing2.dwd.de/";
|
my $urlString = "ftp://$user:$pass\@ftp-outgoing2.dwd.de/";
|
||||||
my $ua = LWP::UserAgent->new; # test
|
my $ua;
|
||||||
$ua->timeout(10); # test
|
eval { $ua = LWP::UserAgent->new; };
|
||||||
$ua->env_proxy; # test
|
|
||||||
|
if(!defined($ua)) {
|
||||||
|
Log3($name, 1, "GDS $name: LWP not available!");
|
||||||
|
readingsSingleUpdate($hash, 'LWP error', 'LWP not available!',1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ua->timeout(10);
|
||||||
|
$ua->env_proxy;
|
||||||
|
|
||||||
given($request){
|
given($request){
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user