RE: Pausing POE::Wheel::FollowTail?
"Votava, Craig M \(Craig\)" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <EDC714147512684D9BFBE6AB9C53AED101AB3B3D@ILEXC1U03.ndc.lucent.com> |
Hi Larry- Thanks for the response! Either of your solutions could be best, but I'm not sure about a couple of things: 1.) Say I save the current state then destroy the wheel. When I start up a new wheel, how do I know whether to use the saved data to index back to where I left off or (if the file has been reset) to just start from the beginning? 2.) If I change PollInterval, what value would I change it to, so that it would never fire? Thanks -Craig -----Original Message----- From: Larry Clapp [mailto:[email protected]] Sent: Monday, October 06, 2008 11:14 AM To: Votava, Craig M (Craig) Cc: [email protected] Subject: Re: Pausing POE::Wheel::FollowTail? 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!