FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: phil1283 am 21 Mai 2022, 22:44:56

Titel: Probleme mit Undefined subroutine &main::
Beitrag von: phil1283 am 21 Mai 2022, 22:44:56
Hallo,

nach sieben Jahren habe ich meinen Raspi mit FHEM neu aufgsetzt und ein Backup aufgespielt. Leider finden sich im Log einige Einträge mit "Undefined subroutine &main::". Bsp.:
Error evaluating Multisensor_MS userReading windAverage: Undefined subroutine &main::movingAverage called at (eval 3643) line 1.
get_PV: Undefined subroutine &main::PV called at (eval 3685) line 1.

Nachdem ich hier im Forum danach gesucht hatte schien es mit der 99_myUtils.pm zusammen zu hängen und dort die Subs zu fehlen. Diese sind aber in der Datei enthalten. Leider sind sie auf der Weboberfläche nicht ausführbar:
{PV()}
ergibt den gleichen Fehler in der Ausgabe: "Undefined subroutine &main::PV called at (eval 7614) line 1."
Es kann allerdings nicht an der myUtils liegen (Ich dachte erst an Problemen mit den Dateirechten), da auch andere aufrufe von Modulen Probleme machen:
Heizung: perl expression eval with expression package main; my @val = @{$oRef->{'%val'}};ModbusLD_ScanFormat($hash, $val) on  created error: Undefined subroutine &main::ModbusLD_ScanFormat called at (eval 6941) line 1.

Jetzt fehlt mir der Ansatz nach weiteren Fehlerquellen zu suchen.

Hat jemand eine Idee?

Vielen Dank.
Titel: Antw:Probleme mit Undefined subroutine &main::
Beitrag von: Prof. Dr. Peter Henning am 23 Mai 2022, 10:34:47
ZitatEs kann allerdings nicht an der myUtils liegen
Das wage ich zu bezweifeln. Wahrscheinlicher ist, dass die 99_myUtils.pm gar nicht geladen wird, weil sie irgendwo einen Fehler produziert. Steht alles im Log beim Start von FHEM.

LG

pah
Titel: Antw:Probleme mit Undefined subroutine &main::
Beitrag von: phil1283 am 23 Mai 2022, 15:40:14
Vielen dank für deinen Hinweis!
Manchmal sind es die einfachen Dinge, die einem nicht einfallen. Mit der Suche nach "Modul 99_myUtils deactivated" in meinem unübersichtlichen Log-File habe ich es gefunden:
reload: Error:Modul 99_myUtils deactivated:
Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/arm-linux-gnueabihf/perl5/5.32 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl-base /usr/lib/arm-linux-gnueabihf/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl ./FHEM) at ./FHEM/99_myUtils.pm line 92.
BEGIN failed--compilation aborted at ./FHEM/99_myUtils.pm line 92.

die  Es liegt wohl an nicht installierten Perl modulen für die myUtils war es das Switch.pm, für das Modbus Modul bin ich noch am Suchen.
Titel: Antw:Probleme mit Undefined subroutine &main::
Beitrag von: phil1283 am 23 Mai 2022, 18:00:36
Die myUtils lädt jetzt, allerdings bin ich noch auf der Suche nach den anderen Fehlern:
PERL WARNING: Use of uninitialized value $seconds in concatenation (.) or string at ./FHEM/73_PRESENCE.pm line 1196.
PERL WARNING: Use of uninitialized value $seconds in addition (+) at ./FHEM/73_PRESENCE.pm line 1199.
PERL WARNING: Use of uninitialized value $val in concatenation (.) or string at ./FHEM/98_Modbus.pm line 2689.
PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 572) line 1.
PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 573) line 1.
PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 574) line 1.
PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 575) line 1.
PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 576) line 1.
PERL WARNING: Use of uninitialized value $apk[0] in sort at ./FHEM/98_FireTV.pm line 228, <$fh> line 2477.
PERL WARNING: Use of uninitialized value $apk[0] in join or string at ./FHEM/98_FireTV.pm line 229, <$fh> line 2477.
PERL WARNING: Use of uninitialized value $apk[0] in join or string at ./FHEM/98_FireTV.pm line 230, <$fh> line 2477.
PERL WARNING: Use of uninitialized value $apk[0] in sort at ./FHEM/98_FireTV.pm line 228, <$fh> line 2574.
PERL WARNING: Use of uninitialized value $apk[0] in join or string at ./FHEM/98_FireTV.pm line 229, <$fh> line 2574.
PERL WARNING: Use of uninitialized value $apk[0] in join or string at ./FHEM/98_FireTV.pm line 230, <$fh> line 2574.
PERL WARNING: Use of uninitialized value $exp_result in pattern match (m//) at ./FHEM/51_RPI_GPIO.pm line 649, <$fh> line 1133.
PERL WARNING: Use of uninitialized value $exp_result in concatenation (.) or string at ./FHEM/51_RPI_GPIO.pm line 659, <$fh> line 1133.


Mein Ansatz war jetzt zu suchen, ob diese Module spezielle Perl Module zum Nachinstallieren benötigen. -Dazu nichts gefunden...

Zum Presence und FireTV Modul habe ich folgendes gefunden: https://forum.fhem.de/index.php?topic=83805.0 (https://forum.fhem.de/index.php?topic=83805.0)

Beim Rest bin ich noch Ratlos
Titel: Antw:Probleme mit Undefined subroutine &main::
Beitrag von: Prof. Dr. Peter Henning am 23 Mai 2022, 18:20:35
Das sind doch nur Warnungen - erstmal ignorieren, bis das System einmal stabil läuft.

LG

pah