Fwd: POE & Tk excessive CPU usage?

Craig Votava <[email protected]> Mon, 11 Jun 2007 10:27:17 -0500
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Folks-

I was wondering if anybody in ptk-land could
help out with this problem. I've posted it
to the POE mailing list, and got corroboration,
but nobody knows what the problem is or how
to fix it.

Apart from this problem, does anybody here
use POE? Do you like it?

Is there something better/different I should try?

Thanks

-Craig

Begin forwarded message:

> From: Craig Votava <[email protected]>
> Date: April 27, 2007 11:15:13 AM CDT
> To: POE Mailing List <[email protected]>
> Subject: POE & Tk excessive CPU usage?
>
> Folks-
>
> When I use POE and Tk together, I see the
> process using up a constant 50% of my CPU,
> even when there's nothing going on.
>
> Am I doing something wrong, or is there a
> good explanation for this? Is there any
> way to reduce this?
>
> Attached is a small test program.
>
> Thanks
>
> -Craig
>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> use Tk;
> use POE;
>
> POE::Session->create
>   ( inline_states =>
>       { _start => \&ui_start,
>         ev_count => sub { $_[HEAP]->{counter}++; },
>         ev_clear => sub { $_[HEAP]->{counter} = 0; },
>       }
>   );
>
> $poe_kernel->run();
> exit 0;
>
> sub ui_start {
>     my ( $kernel, $session, $heap ) = @_[ KERNEL, SESSION, HEAP ];
>
>     $poe_main_window->Label( -text => "Counter" )->pack;
>
>     $heap->{counter} = 0;
>     $heap->{counter_widget} =
>       $poe_main_window->Label( -textvariable => \$heap->{counter} )- 
> >pack;
>
>     $poe_main_window->Button
>       ( -text => "Count",
>         -command => $session->postback("ev_count")
>       )->pack;
>
>     $poe_main_window->Button
>       ( -text => "Clear",
>         -command => $session->postback("ev_clear")
>       )->pack;
> }

--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk