98_inotify: check for missing perl modules / better MID

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@18456 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
marvin78 2019-01-30 10:11:33 +00:00
parent 18f35a32cf
commit 34440b82f5

View File

@ -4,14 +4,17 @@ package main;
use strict; use strict;
use warnings; use warnings;
use Data::Dumper;
use Linux::Inotify2; my $missingModule = "";
use File::Find;
eval "use Data::Dumper;1" or $missingModule .= "Data::Dumper ";
eval "use Linux::Inotify2;1" or $missingModule .= "Linux::Inotify2 ";
eval "use File::Find;1" or $missingModule .= "File::Find ";
####################### #######################
# Global variables # Global variables
my $version = "0.5.5"; my $version = "0.5.7";
our $inotify; our $inotify;
our @watch; our @watch;
@ -86,11 +89,17 @@ sub inotify_Define($$) {
return $msg; return $msg;
} }
return "Cannot define a inotify device. Perl module(s) $missingModule is/are missing." if ( $missingModule );
$hash->{PATH}=$a[2]; $hash->{PATH}=$a[2];
$hash->{FILES}=$a[3]?$a[3]:undef; $hash->{FILES}=$a[3]?$a[3]:undef;
$hash->{VERSION} = $version; $hash->{VERSION} = $version;
$hash->{MID} = 'da39a3ee5e6dfdss434436657657bdbfef95601890afd80709'; #
#$hash->{MID} = 'da39a3ee5e6dfdss434436657657bdbfef95601890afd80709'; #
my $mid = "inotify_".$a[2].$a[3];
$mid =~ s/[^A-Za-z0-9\-_]//g;
$hash->{MID} = $mid;
$hash->{NOTIFYDEV}= "global"; $hash->{NOTIFYDEV}= "global";