Warnungen durch 98_autocreate.pm

Begonnen von mumpitzstuff, 12 Oktober 2018, 00:59:18

Vorheriges Thema - Nächstes Thema

mumpitzstuff

Ich erhalte ständig Warnungen im Logfile:

2018.10.12 00:21:21 1: PERL WARNING: Use of uninitialized value $it in concatenation (.) or string at ./FHEM/98_autocreate.pm line 135.
2018.10.12 00:21:21 1: stacktrace:
2018.10.12 00:21:21 1:     main::__ANON__                      called by ./FHEM/98_autocreate.pm (135)
2018.10.12 00:21:21 1:     main::autocreate_Notify             called by fhem.pl (3597)
2018.10.12 00:21:21 1:     main::CallFn                        called by fhem.pl (3517)
2018.10.12 00:21:21 1:     main::DoTrigger                     called by fhem.pl (3855)
2018.10.12 00:21:21 1:     main::Dispatch                      called by ./FHEM/00_CUL.pm (947)
2018.10.12 00:21:21 1:     main::CUL_Parse                     called by ./FHEM/00_CUL.pm (831)
2018.10.12 00:21:21 1:     main::CUL_Read                      called by fhem.pl (3597)
2018.10.12 00:21:21 1:     main::CallFn                        called by fhem.pl (726)


my $it = AttrVal($me, "ignoreTypes", undef);
$it = "^$it\$" if($featurelevel > 5.8); # Forum #80775


Wenn das Attribut ignoreTypes nicht gesetzt ist, dann ist $it an der Stelle undef und sollte dann auch nicht in der regular Expression verwendet werden. Kurz danach wird es noch einmal verwendet, ohne zu prüfen, ob die Variable definiert ist.

Phill

Damit sollte die Warnung verschwinden. Außerdem hatte die Variable den undef Status verloren bei $featurelevel > 5.8.
my $it = AttrVal($me, "ignoreTypes", undef);
$it = "^$it\$" if(defined $it && $featurelevel > 5.8); # Forum #80775
Homebrew 1-Wire / HomeMatic Mix - Cubietruck mit FHEM als Server - Raspberry PI 3 als Informationsanzeige im MagicMirror Stil - Raspberry Pi 1 als Klingelanlage - VDR

Mein Modul: Talk2Fhem - Mein Tipp: https://forum.fhem.de/index.php/topic,82442.0.html

mumpitzstuff

Die Warning erscheint bei mir jetzt nicht mehr im Log.