On Wed, Feb 11, 2009 at 5:38 PM, Lindolfo Lorn Rodrigues
lorn...@gmail.comwrote:
Hi, sorry for the off-topic but i'm search at google and the uniq list that
i found ( http://groups.google.com/group/theschwartz ) dont have nothing.
I need a something like TheSchwartz::Scheduler, i was thinking in change
TheSchwartz-work method, they will look the time to run a job and execute
the job only when is the rigth time
Does anyone have some tips? I looked at CPAN but dont find anything like
this.
I've been using TheSchwartz::Moosified in my Catalyst app to schedule jobs.
Something along these lines:
package MyApp::Worker;
use base 'TheSchwartz::Moosified::Worker';
sub work {
my ($class, $job) = @_;
print WORKING:. $job-dump();
$job-completed;
}
package main;
use strict;
require MyApp;
use TheSchwartz::Moosified;
my $client = TheSchwartz::Moosified-new( verbose = 1);
MyApp-model('DBIC')-storage-dbh_do(
sub {
my ($storage, $dbh) = @_;
$client-databases([$dbh]) or die $!;
} );
use Date::Manip; Date_Init( TZ=CET);
## schedule a job
my $job = TheSchwartz::Moosified::Job-new(
funcname = 'MyApp::Worker',
run_after= UnixDate(ParseDate('2009-02-12 13:00:00'), '%s' ), ##
run_after expects a secs since epoch value
## you may also wanna set grabbed_until
arg = [ foo = 'bar' ],
);
$client-insert($job) or die $!;
$client-can_do('MyApp::Worker');
$client-work();
-rodrigo
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/