Hi ant9000, I have modified the test program, this time I have confirmed that there is a 'bug?' inside Tk's waitVariable method.

The main script
use strict; use Tk; use Win32::MMF::Shareable; print "Process starting...\n"; my $ns = tie my $wait, 'Win32::MMF::Shareable', 'wait' or die; $wait = 0; my $mw = MainWindow->new; $mw->Button( -text => '$wait', -command => sub { pri +nt "\$wait is $wait\n" } )->pack; $mw->Button( -text => 'waitVariable( \\$wait )', -command => \&start ) +->pack; $mw->Button( -text => 'local $wait++', -command => \&stop ) +->pack; $mw->Button( -text => 'remote $wait++', -command => sub{ syst +em "tkremote.pl" } )->pack; MainLoop; sub start { print "waiting for \$wait (was $wait)\n"; $mw->waitVariable( \$wait ); print "finished waiting for \$wait (is now $wait)\n"; } sub stop { print "\$wait++ by pid $$\n"; $wait++; }

And the child script -
use strict; use Tk; use Win32::MMF::Shareable; tie my $wait, 'Win32::MMF::Shareable', 'wait' or die; print "Remote process $$ increment \$wait...\n"; $wait++;

And I have added debug message to the FETCH method in Shareable.pm. The following is the results I got:

Process starting... # 3008 is pid of main 3008 FETCHING... # pressed waitVariable waiting for $wait (was 0) $wait++ by pid 3008 # pressed local++ 3008 FETCHING... 3008 FETCHING... 3008 FETCHING... finished waiting for $wait (is now 1) 3008 FETCHING... waiting for $wait (was 1) Remote process 3808 increment $wait... # pressed remote++ 3808 FETCHING... # remote process incremented $wait 3008 FETCHING... # pressed 'wait' $wait is 2

As you can see here, eventhough the remote process incremented the $wait variable, the Tk's waitVariable method skipped the FETCH of the tied variable.

Any ideas?


In reply to Re: Re: Tk and waitVariable on tied variables by Roger
in thread Tk and waitVariable on tied variables by Roger

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, 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.