Analizo/Batch/Runner.pm

filter: Statementstmt 100% 15 / 15 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 25.0% 1 / 4 totaltotal 88.4% 23 / 26 CC 2 SCAR 2.9
CC
2
Cov
100%
report_progress
2.0
BEGIN
1.0
new
1.0
CRAP 1.3
« Analizo/Metrics.pm ↑ Summary Analizo/FilenameFilter.pm »
1 package Analizo::Batch::Runner;
2  
3 2 ▶use parent qw(Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
6 5 my ($class, @args) = @_;
7 5 return bless { @args }, $class;
8 }
9  
10 3 ▶sub run($$$) {
Subroutine run: called CC=1 SCAR=0.0
Pod undocumented
11 3 my ($self, $batch, $output) = @_;
12 3 $output->initialize();
13 3 $self->actually_run($batch, $output);
14 3 $output->flush();
15 }
16  
17 # must be implemented by subclasses. Will receive as argument:
18 #
19 # * the batch to be run
20 # * the output object
21 #
22 # This method must iterate over the jobs in some way, depending on the strategy
23 # employed by the subclass, call I<execute> on each job, and feed the job
24 # object to the $output object by calling I<$output->push($job)>. In the end,
25 # the runner must call flush() on the output object.
26 1 ▶sub actually_run {
Subroutine actually_run: called CC=1 SCAR=0.0
Pod undocumented
27 }
28  
29 2 __PACKAGE__->mk_accessors(qw( progress ));
30  
31 3 ▶sub report_progress {
Subroutine report_progress: called CC=2 SCAR=6.9
Pod undocumented
32 3 my ($self, $job, $i, $n) = @_;
33 3 my $progress = $self->progress;
34 3 ▶ if ($progress) {
Branch: 1 branch
BranchTrueFalseTotal
if ($progress) 1 2 3
35 1 &$progress($job, $i, $n);
36 }
37 }
38  
39 2 1;
« Analizo/Metrics.pm ↑ Summary Analizo/FilenameFilter.pm »