in reply to Re: POE, Tk, Simultaneous problem!
in thread POE, Tk, Simultaneous problem!

Change that too:
use warnings; use strict; use Tk; use POE; my $killAll = 0; POE::Session->create (inline_states => {_start => \&startApplication, searchmode => \&sea +rchMode}); POE::Session->create (inline_states => {_start => \&searchUpdate}); POE::Kernel->run(); # Relevant is also: sub startApplication { $poe_main_window->Toplevel(-title => "Search"); $killAll = 1; } sub searchUpdate { while (! $killAll) { sleep 1; print '.'; } }
That is,
use $poe_main_window (which is exported Tk Window by POE).
remove the MainLoop (guess that its's not used with POE!)

Replies are listed 'Best First'.
Re^3: POE, Tk, Simultaneous problem!
by GrandFather (Saint) on Sep 28, 2005 at 06:09 UTC

    Actually you only need:

    use warnings; use strict; use Tk; use POE;

    to get the error! Something to do with how the Tk event loop gets replaced by the POE event loop. The documentation is not clear on this matter!

    I'm doing this on Windows with ActiveState Perl. There may be issues that a different if you are using a different platform or cygwin Perl.


    Perl is Huffman encoded by design.
      Im also useing Windows with ActiveState Perl. Latest perl (This is perl, v5.8.7 built for MSWin32-x86-multi-thread) and not latest POE (didnt exist on activestate!) (v0.29) and I dont have problems running that small testscript.