TaskPipe/Task_SourceFromDB.pm

filter: Statementstmt 52.6% 10 / 19 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 33.3% 2 / 6 Podpod 0.0% 0 / 1 totaltotal 38.7% 12 / 31 CC 3 SCAR 13.2
CC
3
Cov
43%
action
6.0
__ANON__
6.0
__ANON__
2.0
CRAP 3.8
« TaskPipe/InterpParam/MatchHandler_this.pm ↑ Summary TaskPipe/Tool/Command_DeployTables.pm »
1 package TaskPipe::Task_SourceFromDB;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use TaskPipe::Iterator;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 extends 'TaskPipe::Task';
6 1 with 'MooseX::ConfigCascade';
7  
8  
9 sub action{
10 0 ▶ my ($self) = @_;
Subroutine action: not called CC=2 SCAR=17.9
Pod undocumented
11  
12 0 ▶ my $search = $self->param->{search} || {};
Condition0%0/2
$self->param->{'search'} || {}
l!l
00
MC/DC0%0/1
$self->param->{'search'} || {}
$self->param->{'search'}
Truth table0%0/2
A
A= $self->param->{'search'}
Aresult
11
00
13 0 my $rs = $self->sm->table($self->param->{table},'plan')->search($search);
14  
15 return +TaskPipe::Iterator->new(
16 next => sub{
17 0 ▶ my $next = $rs->next;
Subroutine __ANON__: not called CC=2 SCAR=17.9
18 0 ▶ $next = { $next->get_columns } if $next;
Branch: 1 branch
BranchTrueFalseTotal
if $next 0 0 0
19 0 return $next;
20 },
21 0 ▶ count => sub{ $rs->count },
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 ▶ reset => sub{ $rs->reset }
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 0 );
24 }
25  
26  
27 =head1 NAME
28  
29 TaskPipe::Task_SourceFromDB - use a database table as the data source
30  
31 =head1 DESCRIPTION
32  
33 This task takes reads a database table and outputs the records one by one (via a L<TaskPipe::Iterator>). It is intended to be used as the first task in a plan. Each result that is produced from the iterator will be a hashref of column names against record values. You can specify it in the plan as follows:
34  
35 # (tree format):
36  
37 task:
38 name: SourceFromDB
39 table: mysourcetable
40  
41 =head1 AUTHOR
42  
43 Tom Gracey <tomgracey@gmail.com>
44  
45 =head1 COPYRIGHT AND LICENSE
46  
47 Copyright (c) Tom Gracey 2018
48  
49 TaskPipe is free software, licensed under
50  
51 The GNU Public License Version 3
52  
53 =cut
54  
55 1 __PACKAGE__->meta->make_immutable;
56 1 1;
« TaskPipe/InterpParam/MatchHandler_this.pm ↑ Summary TaskPipe/Tool/Command_DeployTables.pm »