Autor Thema: Newbie questions  (Gelesen 260 mal)

Offline malc_b

  • Developer
  • Full Member
  • ****
  • Beiträge: 108
Newbie questions
« am: 09 Februar 2020, 20:07:42 »
Hi,

I'm coding my first module.  I'm using reload module a lot.  I'm not sure I completely understand the process.  It seems like reload reruns X_Initialise  but doesn't rerun X_Define.  Is that correct?

Any module scope variables I assume are lost too, yes?  So all variables need to be attached to the hash?  Or of course locals in the sub, or module constants (variables that don't change that is).  Do I just access these hash variables as normal?  E.g. $hash->{myvar}  or  $hash->{.myvar}.  If so what it the purpose of InternalVal()?

Thanks

Offline rudolfkoenig

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 21939
Antw:Newbie questions
« Antwort #1 am: 09 Februar 2020, 20:43:50 »
Zitat
I'm using reload module a lot.  ....  It seems like reload reruns X_Initialise  but doesn't rerun X_Define.  Is that correct?
Yes. Instead of reload consider starting FHEM in a terminal with "attr global logfile -", and restarting it with "CTRL-C,Arrow-UP,RETURN" for the next development cycle.

Zitat
If so what it the purpose of InternalVal()?
Makes life easier for people hating special characters :)
It is meant for end user: if you use $defs{DeviceName}{InternalName}, and mistype DeviceName, then a lot of hard-to-debug things will happen.