Folks-

Anybody have any thoughts on this? I haven't heard
a whisper yet. Do others see the same thing?

Thanks

-Craig

On Apr 27, 2007, at 11:15 AM, Craig Votava wrote:

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;
}

Reply via email to