FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: FilliFairy am 01 Mai 2015, 16:16:32

Titel: (gelöst) at Kommando bringt PERL WARNING
Beitrag von: FilliFairy am 01 Mai 2015, 16:16:32
Hallo,

nun bin ich schon eine Weile am Suchen und finde einfach die Fehlerursache nicht. Folgende Funktion bringt eine Fehlermeldung im Logfile:


sub
SetPwm_actuator($) {
   my $newActuator = shift;
   ...

   my $newCycleTime = GetPwm_cycleTime();
   my $atDefinition = "define evPwm_cycle at +*$newCycleTime \{SetPwm_OnForOnTime()\}";
   Log 2,"SetPwm_actuator($newActuator): atDefinition = $atDefinition";
   fhem("$atDefinition");
   ...
}


Logfile:

2015.05.01 13:55:23.317 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 45703) line 1.
2015.05.01 13:55:23.773 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 45707) line 1.
2015.05.01 13:55:25.729 2: SetPwm_actuator(6): atDefinition = define evPwm_cycle at +*00:01:00 {SetPwm_OnForOnTime()}


Als Übeltäter habe ich das Absetzen des at Kommandos identifiziert. Nach Auskommentieren der Zeile ist die Fehlermeldung weg:

#      fhem("$atDefinition");

2015.05.01 14:25:53.374 2: SetPwm_actuator(9): atDefinition = define evPwm_cycle at +*00:01:00 {SetPwm_OnForOnTime()}


Unklar ist mir in diesem Zusammenhang auch noch warum die PERL WARNING 2x kommt und warum der Log-Eintrag von der Reihenfolge her hinter den Wanings steht.

Hat jemand eine Idee wie ich das Problem beheben bzw. weiter einkreisen kann?

Vielen Dank.

Mit freundlichem Gruß

FillyFairy
Titel: Antw:at Kommando bringt PERL WARNING
Beitrag von: flurin am 02 Mai 2015, 12:14:28
Versuchs mal mit defmod:


my $atDefinition = "defmod evPwm_cycle at +*$newCycleTime \{SetPwm_OnForOnTime()\}";


Gruss
flurin
Titel: Antw:at Kommando bringt PERL WARNING
Beitrag von: rudolfkoenig am 02 Mai 2015, 13:26:19
Die Fehlermeldung kommt nicht (direkt) aus der sub, da kann ich kein $VALUE entdecken.
Ich wuerde "attr global stacktrace", und evtl. "attr global verbose 5" setzen.
Titel: Antw:at Kommando bringt PERL WARNING
Beitrag von: FilliFairy am 03 Mai 2015, 15:12:03
Hallo Rudi,

Danke für den Hinweis. Das Logfile sieht nun so aus:

2015.05.03 14:11:23.281 1: PERL WARNING: Use of uninitialized value $VALUE in string eq at (eval 386) line 1.
2015.05.03 14:11:23.282 3: eval: {
   Log 3,"evPwm_actuator: Pwm_actuator-actuator: 35";
   SetPwm_actuator("actuator: 35");
}
2015.05.03 14:11:23.284 3: stacktrace:
2015.05.03 14:11:23.285 3:     main::__ANON__                      called by (eval 386) (1)
2015.05.03 14:11:23.285 3:     (eval)                              called by ./FHEM/33_readingsProxy.pm (116)
2015.05.03 14:11:23.286 3:     main::readingsProxy_update          called by ./FHEM/33_readingsProxy.pm (72)
2015.05.03 14:11:23.287 3:     main::readingsProxy_updateDevices   called by ./FHEM/33_readingsProxy.pm (152)
2015.05.03 14:11:23.288 3:     main::readingsProxy_Notify          called by fhem.pl (2964)
2015.05.03 14:11:23.289 3:     main::CallFn                        called by fhem.pl (2887)
2015.05.03 14:11:23.290 3:     main::DoTrigger                     called by fhem.pl (1618)
2015.05.03 14:11:23.290 3:     main::CommandDefine                 called by fhem.pl (996)
2015.05.03 14:11:23.291 3:     main::AnalyzeCommand                called by fhem.pl (869)
2015.05.03 14:11:23.296 3:     main::AnalyzeCommandChain           called by fhem.pl (2976)
2015.05.03 14:11:23.297 3:     main::fhem                          called by ./FHEM/99_myUtils.pm (48)
2015.05.03 14:11:23.298 3:     main::SetPwm_actuator     called by (eval 353) (3)
2015.05.03 14:11:23.299 3:     (eval)                              called by fhem.pl (917)
2015.05.03 14:11:23.299 3:     main::AnalyzePerlCommand            called by fhem.pl (937)
2015.05.03 14:11:23.300 3:     main::AnalyzeCommand                called by fhem.pl (869)
2015.05.03 14:11:23.301 3:     main::AnalyzeCommandChain           called by ./FHEM/91_notify.pm (92)
2015.05.03 14:11:23.302 3:     main::notify_Exec                   called by fhem.pl (2964)
2015.05.03 14:11:23.303 3:     main::CallFn                        called by fhem.pl (2887)
2015.05.03 14:11:23.304 3:     main::DoTrigger                     called by fhem.pl (3651)
2015.05.03 14:11:23.304 3:     main::readingsEndUpdate             called by fhem.pl (3804)
2015.05.03 14:11:23.306 3:     main::readingsSingleUpdate          called by ./FHEM/98_dummy.pm (32)
2015.05.03 14:11:23.306 3:     main::dummy_Set                     called by fhem.pl (2959)
2015.05.03 14:11:23.307 3:     main::CallFn                        called by fhem.pl (1458)
2015.05.03 14:11:23.308 3:     main::DoSet                         called by fhem.pl (1488)
2015.05.03 14:11:23.309 3:     main::CommandSet                    called by fhem.pl (996)
2015.05.03 14:11:23.309 3:     main::AnalyzeCommand                called by fhem.pl (869)
2015.05.03 14:11:23.310 3:     main::AnalyzeCommandChain           called by fhem.pl (2976)
2015.05.03 14:11:23.311 3:     main::fhem                          called by ./FHEM/98_PID20.pm (655)
2015.05.03 14:11:23.312 3:     main::PID20_Calc                    called by fhem.pl (2574)
2015.05.03 14:11:23.313 3:     main::HandleTimeout                 called by fhem.pl (540)

Hmmm - was will dies sagen? Die Zeile

fhem("$atDefinition");

befindet sich in ./FHEM/99_myUtils.pm (48).  Die per at aufgerufenen SetPwm_OnForOnTime() habe ich dann zwischenzeitlich mal komplett "leer" geräumt, jedoch auch ohne Erfolg. Was könnte denn beim fhem Aufruf schiefgehen?

Mit freundlichem Gruß

FillyFairy


Titel: Antw:at Kommando bringt PERL WARNING
Beitrag von: rudolfkoenig am 03 Mai 2015, 15:52:28
Ich habe in readingsProxy_update eine Variable namens VALUE gesehen, ich gehe davon aus, dass readingsProxy etwas darstellen soll, was nicht definiert ist.
Titel: Antw:at Kommando bringt PERL WARNING
Beitrag von: FilliFairy am 11 Mai 2015, 21:23:26
Hallo,

nachdem ich flurins Hinweis nachgegangen bin, konnte ich dann eine (vermutliche) Ursache lokalisieren:

Bei den ausgeblendeten Stellen der Codefragmente waren auch einige relevante Stellen. Weiter oben habe ich ein delete auf das at Kommando gemacht, das ich dann weiter unten wieder anlegen wollte. Ich habe dann auf active / inactive gewechselt und die Fehlermeldung war weg.

Ich vermute also folgenden Zusammenhang:

Innerhalb  einer Funktion ein at gleichen Namens löschen und wieder anlegen führt zur PERL WARNING.

Danke an Rudi und flurin !

Mit freundlichem Gruß

FillyFairy