Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PERL WARNING #949

Closed
elektron-bbs opened this issue Mar 14, 2021 · 5 comments · Fixed by #950
Closed

PERL WARNING #949

elektron-bbs opened this issue Mar 14, 2021 · 5 comments · Fixed by #950
Assignees
Labels

Comments

@elektron-bbs
Copy link
Contributor

Expected Behavior

no Warnings

Actual Behavior

2021.03.14 09:10:05 1: PERL WARNING: Subroutine Utils_Initialize redefined at FHEM/99_Utils.pm line 10.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine time_str2num redefined at FHEM/99_Utils.pm line 16.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine min redefined at FHEM/99_Utils.pm line 26.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine max redefined at FHEM/99_Utils.pm line 36.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine minNum redefined at FHEM/99_Utils.pm line 46.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine maxNum redefined at FHEM/99_Utils.pm line 56.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine abstime2rel redefined at FHEM/99_Utils.pm line 67.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine defInfo redefined at FHEM/99_Utils.pm line 83.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine SVG_time_to_sec redefined at FHEM/99_Utils.pm line 99.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine trim redefined at FHEM/99_Utils.pm line 125.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine ltrim redefined at FHEM/99_Utils.pm line 138.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine rtrim redefined at FHEM/99_Utils.pm line 150.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine UntoggleDirect redefined at FHEM/99_Utils.pm line 162.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine UntoggleIndirect redefined at FHEM/99_Utils.pm line 185.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine IsInt redefined at FHEM/99_Utils.pm line 212.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine fhemNc redefined at FHEM/99_Utils.pm line 219.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine round redefined at FHEM/99_Utils.pm line 238.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine sortTopicNum redefined at FHEM/99_Utils.pm line 245.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine Svn_GetFile redefined at FHEM/99_Utils.pm line 265.
2021.03.14 09:10:05 1: PERL WARNING: Subroutine WriteFile redefined at FHEM/99_Utils.pm line 295.

Steps to Reproduce the Problem

  1. shutdown restart
  2. view log

Specifications

  • Microcontroller: various
  • Version (Firmware): various
  • Versionmodul (FHEM Module): 3.5.1+20210228
@elektron-bbs
Copy link
Contributor Author

Wozu braucht es require "99_Utils.pm"; in der 00_SIGNALduino.pm?
Wenn ich das auskommentiere kann ich keine Unterschiede feststellen, aber die Warnungen kommen nicht mehr.

@sidey79
Copy link
Contributor

sidey79 commented Mar 14, 2021

Das require ist dafür da, dass diese Perl Datei, ich will es nicht Modul nennen, geladen wird.
Andernfalls würden wir uns darauf verlassen, dass irgendwas dafür sorgt, diese Datei zu laden.

Ich habe festgestellt, wenn FHEM mit milnimalisten Definitionen im Testmodus läuft, dass es dieses Modul nicht eigenständig lädt.
Da wir aber Funktionen aus dieser Datei laden, habe ich es mit require eingebunden.

Hmm, war ja klar dass es hier mal wieder einen Konflikt gibt, weil fhem ja nicht über require lädt

@elektron-bbs
Copy link
Contributor Author

elektron-bbs commented Mar 14, 2021

Mit "Testmodus" meinst du wahrscheinlich deine Tests?
Im laufenden Betrieb sollte es nicht erforderlich sein, das Modul extra zu laden.
Zitat aus https://wiki.fhem.de/wiki/DevelopmentModuleIntro:

"Die Schlüsselnummer 99 hat hierbei eine besondere Bedeutung, da alle Module mit dieser Schlüsselnummer beim Start von FHEM automatisch geladen werden, selbst, wenn sie in der Konfiguration nicht verwendet werden."

Da wir z.B. "round" an vielen Stellen verwenden und das auch ohne require "99_Utils.pm" bisher funktionierte und auch jetzt noch funktioniert, gehe ich davon aus, das dieser Satz auch aktuell noch gültig ist.

@sidey79
Copy link
Contributor

sidey79 commented Mar 14, 2021

Hmm, das Laden hängt vom modpath ab und wenn der nicht definiert ist, dann wird relativ zum cwd versucht was zu laden.
Das liegt aber nicht unbedingt im cwd sondern relativ von fhem.pl.

Mit require ließ sich das lösen, da require relativ vom Programm arbeitet.

Blöde Situation, aber ich wüsste nicht, wie ich diesen Zustand umschiffen kann.
Das liegt ja ursächlich daran, dass fhem quasi core Bestandteile als fhem Modul lädt.

Ich kann natürlich ein Patch machen und 99 utils in ein Perl Modul konvertierten.
Das könnte das Problem lösen, aber ich bezweifle, dass der ohne weiteres akzeptiert wird

@HomeAutoUser
Copy link
Contributor

@sidey79 i be back :-P

Vielleicht findest du hier https://forum.fhem.de/index.php?topic=19195.0 einen Hinweis.
Den Ansatz finde ich am besten, erst schauen ob es geladen wurde und wenn NICHT, dann den Bestandteil laden. Damit deckst du beide Fälle ab. (wenn bereits geladen + nicht geladen)

Ein ständiges laden finde ich auch überflüssig (mit den dazugehörigen Logeinträgen).

@sidey79 sidey79 self-assigned this Mar 15, 2021
@sidey79 sidey79 linked a pull request Mar 15, 2021 that will close this issue
3 tasks
@sidey79 sidey79 removed a link to a pull request Mar 18, 2021
3 tasks
@sidey79 sidey79 linked a pull request Mar 18, 2021 that will close this issue
3 tasks
@sidey79 sidey79 added the fixed label Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants