| 1 | package Analizo::Batch; | ||||||||||
| 2 | 14 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 14 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 14 | ▶ | use parent qw( Analizo::Filter::Client ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 19 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 8 | 19 | my ($class, @options) = @_; | |||||||||
| 9 | 19 | return bless { @options }, $class; | |||||||||
| 10 | } | ||||||||||
| 11 | |||||||||||
| 12 | 24 | ▶ | sub next { | ||||||||
|
Subroutine
next: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 13 | 24 | my ($self) = @_; | |||||||||
| 14 | 24 | my $next_job = $self->fetch_next(); | |||||||||
| 15 | 24 | ▶ | if ($next_job) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 19 | $self->share_filters_with($next_job); | |||||||||
| 17 | } | ||||||||||
| 18 | 24 | return $next_job; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | # This method must be overriden by subclasses, and must return a object that | ||||||||||
| 22 | # inherits from Analizo::Job representing the next job to be processed in this | ||||||||||
| 23 | # batch. If there are no pending jobs, i.e. all jobs contained in this batch | ||||||||||
| 24 | # were already returned, then this method must return I<undef> to signal the | ||||||||||
| 25 | # end of the batch. | ||||||||||
| 26 | # | ||||||||||
| 27 | # All jobs returned here MUST have an B<id> set, and it must be unique inside | ||||||||||
| 28 | # the current batch. This can be done with $job->id('SOMEJODIB'). | ||||||||||
| 29 | 2 | ▶ | sub fetch_next { | ||||||||
|
Subroutine
fetch_next: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 30 | 2 | return undef; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | # This method must be overriden by subclasses and return the total amount of | ||||||||||
| 34 | # jobs in this batch. | ||||||||||
| 35 | 2 | ▶ | sub count { | ||||||||
|
Subroutine
count: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 36 | 2 | return undef; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 14 | 1; | |||||||||