PDA

View Full Version : POE & Tk - You used Select and Tk.


j.hallock
02-17-2007, 12:11 AM
I'm running ActivePerl 5.8.8.820 on Windows XP SP2. POE v1.177 downloaded using PPM and Tk 804.027 packaged with ActivePerl.

I consistently receive the message:


*
* POE can't use multiple event loops at once.
* You used Select and Tk.
*
BEGIN failed--compilation aborted at C:/Perl/site/lib/POE/Kernel.pm line 491.
Compilation failed in require at (eval 17)[C:/Perl/site/lib/POE.pm:40] line 1.
BEGIN failed--compilation aborted at (eval 17)[C:/Perl/site/lib/POE.pm:40] line 1.
could not import qw(Kernel) at C:\Projects\pBotty\pBotty.pl line 14
BEGIN failed--compilation aborted at C:\Projects\pBotty\pBotty.pl line 14.

Here is the code that produced the error:

use warnings;
use strict;

use Tk;
use POE;

POE::Session->create
( inline_states =>
{ _start => \&_start,
}
);

sub _start{
my ( $kernel, $session, $heap ) = @_[ KERNEL, SESSION, HEAP ];
$poe_main_window->Frame(-background => '#000000')->pack(qw/-expand 1 -fill both/);
undef;
}

# Run the program until it is exited.
$poe_kernel->run();
exit 0;


I have also tried these to no avail:

use POE qw(Loop::Tk);
-- and --
use POE qw(Loop::TkActiveState);


Please help!

FishMonger
02-17-2007, 07:03 PM
I don't have any experience with POE and only a limited amount with Tk, so I can't provide a definitive answer to the problem. I can't test your script on my Windows system because my ppm and cpan modules are corrupt so I can't install POE, but I did test it on my linux box. The script does execute and open a Tk window, but immediately closes and I don't receive any errors in the terminal window.

I also ran a test using an example from the POE cookbook that you might want to try. If it fails, then there is a problem with either your Tk or POE installation.
http://poe.perl.org/?POE_Cookbook/Tk_Interfaces