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:

my $client_session = $_[KERNEL]->alias_resolve("myClient"); $top->Button( -text =>"Stop", -command => $client_session->postback("sendStop"), )->pack(-side=>'bottom');
When that button is pressed, Tk will send a "sendStop" to the "myClient" session. If it works, you can discard the stop() function.

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.


In reply to Re: Confusion with POE & pTk by rcaputo
in thread Confusion with POE & pTk by cmv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.