1 package DBIx::Class::Schema::Job;
4 use Moose::Util::TypeConstraints;
8 DBIx::Class::Schema::Job; A job associated with a Schema
12 The following example creates a new job and then executes it.
14 my $job = DBIx::Class::Schema->new(runs => sub { print 'did job'});
15 $job->execute; # 'did job' -> STDOUT
19 This is a base class intended to hold code that get's executed by the schema
20 according to rules known to the schema. Subclassers may wish to override how
21 the L</runs> attribute is defined in order to create custom behavior.
25 This package defines the following subtypes
29 A coderef based type that the job runs when L</execute> is called.
33 subtype 'DBIx::Class::Schema::Job::Handler'
36 coerce 'DBIx::Class::Schema::Job::Handler'
39 my $handler_method = $_;
42 my $target = shift @_;
43 $target->$handler_method($job, @_);
49 This package defines the following attributes.
53 This is a coderef which is de-reffed by L</execute> and is passed the job object
54 (ie $self), and any additional arguments passed to L</execute>
60 isa=>'DBIx::Class::Schema::Job::Handler',
68 This module defines the following methods.
70 =head2 execute ($schema, $query_interval)
72 Method called by the L<DBIx::Class::Schema> when it wants a given job to run.
77 return $_[0]->runs->(@_);
83 See L<DBIx::Class> for more information regarding authors.
87 You may distribute this code under the same terms as Perl itself.