Atsushi Kobayashi > Jonk > Jonk::Client

Download:
Jonk-0.05.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

Jonk::Client - job enqueue client class.

SYNOPSIS ^

    use DBI; 
    use Jonk::Client;
    use DateTime;
    
    my $dbh = DBI->connect(...);
    my $jonk = Jonk::Client->new($dbh, 
        {
            table_name => 'jonk_job',
            enqueue_time_callback => sub {
                DateTime->now->strftime('%Y-%m-%d %H:%M:%S');
            },
        }
    );

METHODS ^

my $jonk = Jonk::Client->new($dbh, $options);

Creates a new Jonk object, and returns the object.

$option is an optional settings.

my $job_id = $jonk->enqueue($func, $arg);

enqueue a job to a database. returns job.id.

my $errstr = $jonk->errstr;

get most recent error infomation.

ERROR HANDLING ^

  my $job_id = $jonk->enqueue('func','arg');
  if ($jonk->errstr) {
      die $jonk->errstr;
  }
syntax highlighting: