Skip to content

Instantly share code, notes, and snippets.

@mattn
Created May 22, 2009 00:26
Show Gist options
  • Save mattn/115844 to your computer and use it in GitHub Desktop.
Save mattn/115844 to your computer and use it in GitHub Desktop.
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 } );
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