SQL/Abstract/Role/Plugin.pm

filter: Statementstmt 100% 21 / 21 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 3 / 3 totaltotal 97.1% 34 / 35 CC 4 SCAR 7.0
CC
4
Cov
96%
register
3.0
apply_to
2.0
BEGIN
1.0
CRAP 2.0
« SQL/Abstract/Parts.pm ↑ Summary SQL/Abstract/Reference.pm »
1 package SQL::Abstract::Role::Plugin;
2  
3 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 has sqla => (
6 is => 'ro', init_arg => undef,
7 handles => [ qw(
8 expand_expr render_aqt join_query_parts
9 ) ],
10 );
11  
12 41 ▶sub cb {
Subroutine cb: called CC=1 SCAR=0.0
Pod documented
13 41 my ($self, $method, @args) = @_;
14 215 ▶ return sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
15 215 local $self->{sqla} = shift;
16 215 $self->$method(@args, @_)
17 41 };
18 }
19  
20 6 ▶sub register {
Subroutine register: called CC=3 SCAR=11.0
Pod documented
21 6 my ($self, @pairs) = @_;
22 6 my $sqla = $self->sqla;
23 6 ▶ while (my ($method, $cases) = splice(@pairs, 0, 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@pairs, 0, 2)) 17 6 23
24 17 my @cases = @$cases;
25 17 ▶ while (my ($name, $case) = splice(@cases, 0, 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@cases, 0, 2)) 39 17 56
26 39 $sqla->$method($name, $self->cb($case));
27 }
28 }
29 6 return $self;
30 }
31  
32 1 ▶sub apply_to {
Subroutine apply_to: called CC=2 SCAR=7.0
Pod documented
33 1 my ($self, $sqla) = @_;
34 1 ▶ $self = $self->new unless ref($self);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 1 0 1
35 1 local $self->{sqla} = $sqla;
36 1 $self->register_extensions($sqla);
37 }
38  
39 1 requires 'register_extensions';
40  
41 1 1;
42  
43 __END__
« SQL/Abstract/Parts.pm ↑ Summary SQL/Abstract/Reference.pm »