SQL/Abstract/Role/Plugin.pm

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