Created
May 22, 2009 00:26
-
-
Save mattn/115844 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use TheSchwartz::Moosified; | |
use DBD::SQLite; | |
my $dbh = DBI->connect("dbi:SQLite:dbname=test.db"); | |
my $client = TheSchwartz::Moosified->new(); | |
$client->databases([$dbh]); | |
$client->insert('My::Worker', { args1 => 1, args2 => 2 } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package My::Worker; | |
use strict; | |
use warnings; | |
use base 'TheSchwartz::Moosified::Worker'; | |
use YAML; | |
sub work { | |
my ($class, $job) = @_; | |
my $arg = $job->arg; | |
warn Dump $arg; | |
$job->completed; | |
} | |
package main; | |
use TheSchwartz::Moosified; | |
use DBD::SQLite; | |
my $dbh = DBI->connect("dbi:SQLite:dbname=test.db"); | |
my $client = TheSchwartz::Moosified->new(); | |
$client->databases([$dbh]); | |
$client->verbose( 1 ); | |
$client->can_do('My::Worker'); | |
$client->work(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment