http://qs321.pair.com?node_id=578602

jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed monks,

In a Perl/Tk application I create a notebook, then a tab which I populate. One of the fields is a Tk::Entry which is to get a file name. But when the variable gets updated, the value shown in the Tk::Entry does not change on the screen.

Draw the notebook:
sub draw { my $self = shift; print "Notebook Page ", $self->{_nb}; my $notebook = $self->{_nb}->parent(); #$notebook->pageconfigure( 'page12', -raisecmd => sub { $self->_load +_configs } ); #notebook portion $self->{_subnb} = $self->{_nb}->NoteBook()->grid(); $self->{subnb_p1} = $self->{_subnb}->add( 'page1', -label => 'Prepar +e email message' ); $self->_draw_subnb_p1(); }
then populate it:
sub _draw_subnb_p1 { my $self = shift; # FRAME - top left side $self->{subnb_p1}->Label( -text => 'Email Subject', )->grid( $self->{subnb_p1}->Entry( -width => 50, -textvariable => \$::cini_global->{trickle}->{subject}, ), -padx => 5, -pady => 5, ); $self->{subnb_p1}->Label( -text => 'Email template', -width => '12', )->grid( $self->{subnb_p1}->Entry( -width => '50', -textvariable => \$::cini_global->{trickle}->{email_template_fil +e} ), $self->{subnb_p1}->Button( -text => 'Browse', -command => sub { $self->_getImportFile() }, ), $self->{_edemail_button} = $self->{subnb_p1}->Button( -text => 'Edit', -command => sub { $self->_edit_emailtemplate() }, ), -padx => 5, -pady => 5, ); my $top = $self->{subnb_p1}->Frame( -borderwidth => 2, -relief => 'r +aised' )->grid(); $top->Button( -text => 'Preview Email', -command => sub { $self->_preview_emailtemplate() }, )->grid( $top->Button( -text => 'Send Emails', -command => sub { $self->_send_emails() }, ), -padx => 5, -pady => 5, ); }
 $::cini_global is a global configuration hash whioch is populate using Config::IniHash

Now click on the button to change the file name and this gets called:

sub _getImportFile { my $self = shift; # Get the name of the file we are going to import my @types = ( [ "TMPL files", '.tmpl' ], [ "All Files", "*" ], ); $::cini_global->{trickle}->{email_template_file} = $self->{_nb}->get +OpenFile( -filetypes => \@types ); if ( $::cini_global->{trickle}->{email_template_file} ) { $self->{_edemail_button}->configure( -state => 'normal' ); } WriteINI( $::CONFIG_FILE, $::cini_global ); print Dumper $::cini_global; $self->{_mw}->update(); }
You will see as soon as I get the file name I write the config hash back to disk - just in case. I can see the file change when I look at it, but despite the fact that $::cini_global->{trickle}->{email_template_file} has changed the display does not change! Am I doing something stupid here? Or is there a bug somewhere??

jdtoronto