| 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
| |||||||||||
| 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
| |||||||||||
| 27 | 34 | my @cases = @$cases; | |||||||||
| 28 | 34 | ▶ | while (my ($name, $case) = splice(@cases, 0, 2)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||