Re: Best pick for time-based 'event' looping?
2009/4/16 Randy J. Ray rj...@blackperl.com: I might be using the wrong tech-terminology here, so bear with me... What I'm looking for is a best-of-breed sort of CPAN solution for a job-queue processor in which the jobs are run based on time. Not quite cron, mind you, but not too different from that. In essence: POE?
Re: Best pick for time-based 'event' looping?
On Thu, 16 Apr 2009, Peter Corlett wrote: On Wed, Apr 15, 2009 at 06:16:56PM -0700, Randy J. Ray wrote: What I'm looking for is a best-of-breed sort of CPAN solution for a job-queue processor in which the jobs are run based on time. Not quite cron, mind you, but not too different from that. In essence: What you described sounds awfully like at(1), and the crufty hacks people used on VMS to do a cron-equivalent. (VMS only had an at-equivalent when I last poked at it.) We use this beast on VMS (and have been for a while) to make scheduling Fun! http://www.mvpsi.com/OpenVMS.aspx It does stuff on non-VMS platforms as well but I suspect it is both expensive and overkill for most people's needs. It does allow time based scheduling though, which is nice :) --billy -- http://billyabbott.co.uk I think commas are a tool of oppression.
Re: Best pick for time-based 'event' looping?
T'was a few years since I used this, the namespace has changed, but perhaps of some use? : http://search.cpan.org/~lembark/Parallel-Queue-2.01/ mart. 2009/4/16 Randy J. Ray rj...@blackperl.com: I might be using the wrong tech-terminology here, so bear with me... What I'm looking for is a best-of-breed sort of CPAN solution for a job-queue processor in which the jobs are run based on time. Not quite cron, mind you, but not too different from that. In essence: 1. Init job queue 2. Add first task, which should happen immediately 3. (Loop starts here) Queue/Event-handler knows how long it has to wait before peeling the next task off the head of the queue and processing it. 4. Task runs, might insert some new, different tasks with their own offset-from-now values expressed in seconds. For example, the main task re-inserts itself to run again in 15 minutes, after it has checked a certain RSS feed for Last-Updated and possibly read it and parsed it. 5. Loop back to #3 6. Profit (this step is never actually reached) Right now, the application (the twitter-bot behind the cpan_linked Twitter account) has a really clumsy time-based loop. I'm planning on adding some more functionality to it (anwering @-messages, allowing me to control it remotely with direct messages, etc.), and it would be a good time to replace this loop with something less, well, hideous. Something I wouldn't be embarrassed to have on CPAN... Randy -- rj...@blackperl.com
Re: Best pick for time-based 'event' looping?
On Wed, 15 Apr 2009 18:16:56 -0700 Randy J. Ray rj...@blackperl.com wrote: 1. Init job queue 2. Add first task, which should happen immediately 3. (Loop starts here) Queue/Event-handler knows how long it has to wait before peeling the next task off the head of the queue and processing it. 4. Task runs, might insert some new, different tasks with their own offset-from-now values expressed in seconds. For example, the main task re-inserts itself to run again in 15 minutes, after it has checked a certain RSS feed for Last-Updated and possibly read it and parsed it. 5. Loop back to #3 6. Profit (this step is never actually reached) IO::Async could make easy work of that http://search.cpan.org/~pevans/IO-Async-0.19/lib/IO/Async.pm specifically, you'll be wanting something like use IO::Async::Loop; my $loop = IO::Async::Loop-new(); sub take_over_world { print Same thing we do every day Pinky...\n; $loop-enqueue_timer( delay = 3, # in seconds code = sub { take_over_world() }, ); } take_over_world(); $loop-loop_forever; -- Paul LeoNerd Evans leon...@leonerd.org.uk ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/ signature.asc Description: PGP signature
Re: Best pick for time-based 'event' looping?
On Wed, Apr 15, 2009 at 06:16:56PM -0700, Randy J. Ray wrote: What I'm looking for is a best-of-breed sort of CPAN solution for a job-queue processor in which the jobs are run based on time. Not quite cron, mind you, but not too different from that. In essence: What you described sounds awfully like at(1), and the crufty hacks people used on VMS to do a cron-equivalent. (VMS only had an at-equivalent when I last poked at it.)
Re: system() with timeout
On Thu, Apr 16, 2009 at 06:18:45PM +0100, David Cantrell wrote: Anyone recommend a module to give me something like system(@list) but with a timeout? Does IPC::Run have something suitable? I seem to recall it has quite a lot of interesting things to fiddle with... -- Paul LeoNerd Evans leon...@leonerd.org.uk |CPAN ID: PEVANS srand($,= );print sort{rand0.5}grep{0.8rand}qw(another Just hacker of Perl) signature.asc Description: Digital signature
Re: system() with timeout
On Thu, Apr 16, 2009 at 06:32:08PM +0100, Paul LeoNerd Evans wrote: On Thu, Apr 16, 2009 at 06:18:45PM +0100, David Cantrell wrote: Anyone recommend a module to give me something like system(@list) but with a timeout? Does IPC::Run have something suitable? I seem to recall it has quite a lot of interesting things to fiddle with... Yes, that looks like exactly what I wanted. Thanks! -- David Cantrell | Minister for Arbitrary Justice Please stop rolling your Jargon Dice and explain the problem you are having to me in plain English, using small words. -- John Hardin, in the Monastery