Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I'm suspicious of Config::IniHash myself... I'm operating under the assumption that the $cini_global is a hashRef, and I know that getOpenFile returns a scalar -- in this case a selected filename. Here's a shortened example:

use Tk; use strict; $::cini_global = { trickle => { email_template_file => "nothing" }}; my $mw = MainWindow->new; $mw->Entry( -width => 40, -textvariable => \$::cini_global->{trickle}->{email_template_file} )->pack(qw/-expand 1 -fill x/); $mw->Button( -text => "Change", -command => sub { $::cini_global->{trickle}->{email_template_file} = $mw->getOpenFile(); })->pack; MainLoop;

I suspect there's something else going on outside of the shown code. Perhaps Config::IniHash creates something different than what it appears

Update: It would seem that Config::IniHash does some pretty interesting things under the hood and isn't exactly what it seems. I haven't looked at all the code, but my guess is that the two times you use it, the internal references are different. I've added a second example that shows how I'd work around it if I had to use Config::IniHash, which I'm not certain that I would.

<crotchety voice>Config::IniHash seems a bit too clever for its own good to me</crotchety voice> Still, its code makes for pretty interesting reading ;-)

Example 2 : In the second example I was able to reprodce the reported problem. The code shows how I worked around it.

config file, containing:

[trickle] email_template_file=nothing

Script with workaround:

use strict; use Config::IniHash; use Data::Dumper; use Tk; $::cini_global = ReadINI 'config'; my $ref = $::cini_global->{trickle}->{email_template_file}; my $mw = MainWindow->new; $mw->Entry( -width => 40, -textvariable => \$ref )->pack(qw/-expand 1 -fill x/); $mw->Button( -text => "Change", -command => sub { $ref = $mw->getOpenFile(); $::cini_global->{trickle}{email_template_file} = $ref; })->pack; MainLoop;
Rob

In reply to Re^2: Tk::Entry not updating when textvariable changes. by rcseege
in thread Tk::Entry not updating when textvariable changes. by jdtoronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (8)
    As of 2015-07-30 01:30 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (269 votes), past polls