Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Tk::waitVariableX - AUTOLOAD failed

by jowe (Sexton)
on Apr 09, 2013 at 14:48 UTC ( #1027757=perlquestion: print w/replies, xml ) Need Help??

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

Hi PerlMonks,
the following code snippet demonstates my problem:
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::waitVariableX; my $mw = MainWindow->new(); my $unchanged_var = ' '; while () { my $numtime = time (); my ($curr_sec, $curr_min, $curr_hour, $curr_mday, $curr_month, $cu +rr_year, $curr_wday, $curr_yday, $curr_isdst) = localtime ($numtime); + my $lab1 = $mw->Label (-text => 'time returned: ' . $curr_hour . ' +:' . $curr_min . ':' . $curr_sec) ->form(-left => '%5', -top => '%10'); $lab1->update; $mw->waitVariableX (5 * 1000, \$unchanged_var); # sleep 5 secon +ds } MainLoop;

The package (Tk::waitVariableX from cpan) installs ok but it seems like something is not set during the install process.
My environment: Windows 7, ActivePerl MSWin32, Tk: 804.030, Tk::waitVariableX: 1.0
The same behavior under Linux.
Could you please let me know what I am doing wrong.
Thanks for your help - jowe

Replies are listed 'Best First'.
Re: Tk::waitVariableX - AUTOLOAD failed
by choroba (Archbishop) on Apr 09, 2013 at 15:03 UTC
    The documentation is very laconic, but it seems you should use
    where $splash is Tk::Splashscreen.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: Tk::waitVariableX - AUTOLOAD failed
by hdb (Monsignor) on Apr 09, 2013 at 15:08 UTC

    I do not know why, seems strange object interface, but the following seems to work (experimental Perl):

    waitVariableX ($mw, 5 * 1000, \$unchanged_var); # sleep 5 secon +ds
      Thanks very much. It solved the problem (dont know why).
      Thanks again - jowe

        The documentation and the code of the module are looking inconsistent. The documentation says:

        $splash->waitVariableX( [$millis, $destroy_splashscreen], \$v1, \$v2} +);

        while in the code

        sub waitVariableX { use Tie::Watch; my ($parent, $millis) = (shift, shift); # @_ has list of var refs

        the arguments have different names (and probably different meaning as well).

Re: Tk::waitVariableX - AUTOLOAD failed
by choroba (Archbishop) on Apr 09, 2013 at 15:36 UTC
    What are you trying to achieve? If you just want something to happen repeatedly, use Tk::after. The module you use is intended for splash screens only.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Intention is to implement a non-blocking wait (other Tk-events to be processed), which may be interrupted by a 'wait-timer' or by a variable changing its content - whatever occurs first. The repetition (while loop) is merely used to demonstrate the issue.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1027757]
Approved by marto
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2021-09-25 02:22 GMT
Find Nodes?
    Voting Booth?

    No recent polls found