36_JeeLink.pm: check if LWP::UserAgent and HTTP::Request::Common are available

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@10847 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme1968
2016-02-14 15:49:37 +00:00
parent c6ebf2609a
commit 00e6281d98

View File

@@ -7,8 +7,6 @@ use strict;
use warnings;
use Time::HiRes qw(gettimeofday);
use Time::Local;
use LWP::UserAgent;
use HTTP::Request::Common;
sub JeeLink_Attr(@);
sub JeeLink_Clear($);
@@ -250,13 +248,19 @@ JeeLink_Set($@)
$log .= "hex file: $hexFile\n";
if($detectedFirmware eq "LaCrosseGateway.bin") {
eval "use LWP::UserAgent";
return "\nERROR: Please install LWP::UserAgent" if($@);
eval "use HTTP::Request::Common";
return "\nERROR: Please install HTTP::Request::Common" if($@);
$log .= "Mode is LaCrosseGateway OTA-update\n";
DevIo_CloseDev($hash);
$hash->{STATE} = "disconnected";
$log .= "$name closed\n";
my @spl = split(':', $hash->{DeviceName});
my $targetIP = @spl[0];
my $targetIP = $spl[0];
my $targetURL = "http://" . $targetIP . "/ota/firmware.bin";
$log .= "target: $targetURL\n";