in reply to Confusion with POE & pTk
The problem is that your POE::Session instance is only doing one POEy thing: tailing that file. When it stops, POE recognizes that nothing POEy is happening and stops the seesion for inactivity.
The program needs a way to say: I'm getting events from Tk, so I'll stick around as long as the user interface is present.
POE has this, through POE::Session's postback() method. Postbacks are anonymous subroutines that, when called, post events. They also have a side effect: as long as they exist, the target session will remain alive.
Try this:
When that button is pressed, Tk will send a "sendStop" to the "myClient" session. If it works, you can discard the stop() function.my $client_session = $_[KERNEL]->alias_resolve("myClient"); $top->Button( -text =>"Stop", -command => $client_session->postback("sendStop"), )->pack(-side=>'bottom');
The unresponsiveness happens because POE::Wheel::FollowTail has already read the entire file and generated events for each line. Your button press is enqueued at the end of all that.
You'll either have to wait it out, or not seek so far from the end of the file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Confusion with POE & pTk (not yet unconfused)
by cmv (Chaplain) on Oct 13, 2008 at 18:17 UTC | |
by rcaputo (Chaplain) on Oct 16, 2008 at 18:04 UTC |