1 package DBIx::Class::Schema::AtQueryInterval;
7 DBIx::Class::Schema::Role::AtQueryInterval; Defines a job control interval.
11 The following example shows how to define a job control interval and assign it
12 to a particular L<DBIx::Class::Schema::Job> for a L<DBIx::Class::Schema>
14 my $job = DBIx::Class::Schema->new(runs => sub { print 'did job'});
15 my $interval = DBIx::Class::Schema::Interval->new(every => 10);
17 if($interval->matches($query_count)) {
18 print "I indentified the query count as matching";
21 ## $schema->isa(DBIx::Class::Schema);
22 $schema->create_and_add_at_query_intervals($interval => $job);
26 An AtQueryInterval is a plan object that will execute a certain
30 This package defines the following attributes.
32 =head2 job (DBIx::Class::Schema::Job)
34 This is the job which will run at the specified query interval
40 isa=>'DBIx::Class::Schema::Job',
48 This is the interval we are watching for
54 isa=>'DBIx::Class::Schema::QueryInterval',
62 This module defines the following methods.
64 =head2 execute_if_matches ($query_count, @args)
66 Does the $query_count match the defined interval? Returns a Boolean.
70 sub execute_if_matches {
71 my ($self, $query_count, @args) = @_;
72 if($self->matches($query_count)) {
73 return $self->execute(@args);
82 See L<DBIx::Class> for more information regarding authors.
86 You may distribute this code under the same terms as Perl itself.