| 1 | package Database::Async::Engine; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 6 | our $VERSION = '0.019'; # VERSION | |||||||||
| 7 | |||||||||||
| 8 | 6 | ▶ | use parent qw(IO::Async::Notifier); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | =head1 NAME | ||||||||||
| 11 | |||||||||||
| 12 | Database::Async::Engine - base class for database implementation support in L<Database::Async> | ||||||||||
| 13 | |||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||
| 15 | |||||||||||
| 16 | =cut | ||||||||||
| 17 | |||||||||||
| 18 | 6 | ▶ | use URI; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 6 | ▶ | use Scalar::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | 6 | our %ENGINE_MAP; | |||||||||
| 22 | |||||||||||
| 23 | UNITCHECK { require Database::Async::Engine::Empty } | ||||||||||
| 24 | |||||||||||
| 25 | =head2 register_class | ||||||||||
| 26 | |||||||||||
| 27 | Class method which will register a package name for a given engine type. | ||||||||||
| 28 | |||||||||||
| 29 | =cut | ||||||||||
| 30 | |||||||||||
| 31 | 6 | ▶ | sub register_class { | ||||||||
|
Subroutine
register_class: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 32 | 6 | my ($self, $name, $engine_class) = @_; | |||||||||
| 33 | 6 | ▶ | die 'already have handler for ' . $name if exists $ENGINE_MAP{$name}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 6 | $ENGINE_MAP{$name} = $engine_class; | |||||||||
| 35 | 6 | return; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | sub uri { shift->{uri} } | ||||||||
|
Subroutine
uri: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 39 | 0 | ▶ | sub db { shift->{db} } | ||||||||
|
Subroutine
db: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | sub configure { | ||||||||
|
Subroutine
configure: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 42 | 0 | my ($self, %args) = @_; | |||||||||
| 43 | 0 | for (qw(uri)) { | |||||||||
| 44 | 0 | ▶ | $self->{$_} = URI->new('' . delete($args{$_})) if exists $args{$_}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | } | ||||||||||
| 46 | 0 | for (qw(db)) { | |||||||||
| 47 | 0 | ▶ | Scalar::Util::weaken($self->{$_} = delete $args{$_}) if exists $args{$_}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | } | ||||||||||
| 49 | 0 | $self->next::method(%args); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 6 | 1; | |||||||||
| 53 | |||||||||||
| 54 | =head1 AUTHOR | ||||||||||
| 55 | |||||||||||
| 56 | Tom Molesworth C<< <TEAM@cpan.org> >> | ||||||||||
| 57 | |||||||||||
| 58 | =head1 LICENSE | ||||||||||
| 59 | |||||||||||
| 60 | Copyright Tom Molesworth 2011-2023. Licensed under the same terms as Perl itself. | ||||||||||
| 61 | |||||||||||