I have a peculiar problem using module Tkx in combination with module Storable. The purpose is to store all parameters entered by a user in a Tk interface in a file so that it can be loaded the next time when the program is started again.
I have simplified the code here, there is only one parameter $Value and a simple Tk screen with only one entry field linked to $Value. I first store and retrieve $Value and this works OK. Then I change the value with the Tk screen and then things go strange:
my $Value = 666; store( \$Value, 'param.ini' ); # The file viewed in Wordpad shows 'pst0 12345678 ' my $pRPar = retrieve('param.ini'); $Value = $$pRPar; print("$Value\n"); # Prints '666' my $MainWindow = Tkx::widget->new('.'); my $Entry = $MainWindow->new_ttk__entry(-textvariable => \$Value); $Entry->g_grid(-row => 1, -column => 1); Tkx::MainLoop(); # Change the value into '111' and close the window print("$Value\n"); # Prints '111', so this is OK. But... store( \$Value, 'param.ini' ); # The file viewed in Wordpad shows now 'pst0 12345678Tcl:: +Var Tcl^ ::perl::SCALAR(0x3b54b38)'
So the first time the value is stored correctly (if you use a string instead of an integer you will see the string value in the file). The second time you see strange things appear such as 'Tcl::Var' and '::perl::SCALAR(0x3b54b38)'.
Any idea what's happening here?
In reply to Strange behaviour of Tkx in combination with Storable by JanLaloux
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |