Hi there, this is my first post, and first of all... sorry for my english! I have a routine that calls another routine that creates a new Tk object by the repeat method; then, I need to know if the repeat object is working before the caller routine continue with its work; I tried to do this with the select function inside the coller routine; it should wait the change of a variable I set with the callback inside the repeat object; when I do that, it seems that even the callback doesn't start, and the "wait routine" remain in the while/select loop because the variable doesn't change. thak you in advance to everyone for the patience. here some code:
use Tk; my $MW = MainWindow->new(); ... ... $REFRESH{xyz} = \&xyz; ... # The "wait routine" { my ($WidRFR) = $REFRESH{$ID}->(); # Call the function while($CTRL_REFRESH < 1) { select(undef,undef,undef,0.1); } # this + waits until the var changes # Do some stuff } ... # The routine with the repeat Object sub xyz{ my $RFR = $MW->repeat( 500, sub{ { $CTRL_REFRESH = 1; # Do some stuff.... if(...) { $CTRL_REFRESH = 2; } # This is to notify the end o +f the work and it Works } } ); return($RFR); # Pass the object to the caller to make it able to d +estroy it }; ...

In reply to Perl/Tk repeat method, callback doesn't work if... by NewMonkMark

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.