line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Database::Async::Engine; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
17
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
72
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
136
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.015'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
13
|
use parent qw(IO::Async::Notifier); |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
19
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Database::Async::Engine - base class for database implementation support in L |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
293
|
use URI; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
19
|
2
|
|
|
2
|
|
11
|
use Scalar::Util; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
695
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
sub register_class { |
32
|
2
|
|
|
2
|
1
|
7
|
my ($self, $name, $engine_class) = @_; |
33
|
2
|
50
|
|
|
|
8
|
die 'already have handler for ' . $name if exists $ENGINE_MAP{$name}; |
34
|
2
|
|
|
|
|
6
|
$ENGINE_MAP{$name} = $engine_class; |
35
|
2
|
|
|
|
|
6
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
0
|
|
sub uri { shift->{uri} } |
39
|
0
|
|
|
0
|
0
|
|
sub db { shift->{db} } |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub configure { |
42
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
43
|
0
|
|
|
|
|
|
for (qw(uri)) { |
44
|
0
|
0
|
|
|
|
|
$self->{$_} = URI->new('' . delete($args{$_})) if exists $args{$_}; |
45
|
|
|
|
|
|
|
} |
46
|
0
|
|
|
|
|
|
for (qw(db)) { |
47
|
0
|
0
|
|
|
|
|
Scalar::Util::weaken($self->{$_} = delete $args{$_}) if exists $args{$_}; |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
$self->next::method(%args); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 AUTHOR |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Tom Molesworth C<< >> |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 LICENSE |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Copyright Tom Molesworth 2011-2021. Licensed under the same terms as Perl itself. |
61
|
|
|
|
|
|
|
|