[mh] %Save data corruption when using MQTT

Brian M <[email protected]> Sun, 3 Sep 2023 09:29:27 -0700
Newsgroups gmane.comp.misc.misterhouse.user
Message-ID <[email protected]>
Just an FYI at this point ...

I've discovered that %Save can become corrupted if mqtt_items.pm (or 
apparently mqtt_discovery.pm) are used. The reason is that these two 
contain:

$Data::Dumper::Maxdepth = 3;

That statement changed the maximum output depth that Data::Dumper dumps 
to three levels, but it does it *globally*. Since the routine to write 
%Save to disk uses Data::Dumper, any data stored in %Save that goes 
deeper than three (and I have several) get the lower nodes replaced with 
"HASH(0x...)" or "ARRAY(0x...)". Obviously, those don't restore well on 
restart.

There are object-oriented calls to Data::Dumper that, I believe, keep 
changes to Maxdepth localized to the object, so that would be a possible 
way to correct the code. I'd do it, but I've got a house guest this 
week, so no time.

It took me a long time to determine why some unrelated code of mine was 
suddenly getting garbage in its %Save data, so I thought I should put 
out an alert. Hopefully, this will save some future MQTT user some pain, 
if it doesn't get fixed right away.

                      -Brian M.



________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users