Re: Pausing POE::Wheel::FollowTail?

Larry Clapp <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
On Mon, Oct 06, 2008 at 10:11:42AM -0500, Votava, Craig M (Craig) wrote:
> I wrote a simple perl application that uses POE::Wheel::FollowTail
> to get entries out of a logfile, and puts them up in a Tk Text
> window.
> 
> I want to add a pause/resume toggle button at the bottom of the Text
> window, so that the user can stop and start the incoming data
> whenever they want. When the input is paused, I would like to have
> minimal impact on the CPU. If the pause lasts long enough to where
> the file is reset, then the user would get the data starting at the
> beginning of the current file once they unpause. What is the best
> way to do this?
> 
> I wonder if it would make sense to add a pause method to this
> module? If the general consensus is yes, I can volunteer to take a
> stab at it. If there is a better/easier/faster way to do it with the
> existing methods, please let me know.

I am new to POE, but it seems to me you could either

  - use tell() to get the current position
  - destroy the wheel
  - recreate it when you're ready and set the Seek to the previous
    position

  (There's actually an example of this in the POE::Wheel::FollowTail
  manpage under tell().)

or

  - Alter (or subclass) FollowTail so that you can change the
    PollInterval dynamically.

Neither would be very hard.

-- Larry


p.s.  Hi, POE list!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.