line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Aniki::Plugin::WeightedRoundRobin; |
2
|
1
|
|
|
1
|
|
500
|
use 5.014002; |
|
1
|
|
|
|
|
4
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
411
|
use Mouse::Role; |
|
1
|
|
|
|
|
872
|
|
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
657
|
use Aniki::Handler::WeightedRoundRobin; |
|
1
|
|
|
|
|
84
|
|
|
1
|
|
|
|
|
47
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
0
|
1976
|
sub handler_class { 'Aniki::Handler::WeightedRoundRobin' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
1; |
12
|
|
|
|
|
|
|
__END__ |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=pod |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=encoding utf-8 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Aniki::Plugin::WeightedRoundRobin - Connect to database in a Weighted RoundRobin manner |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
package MyDB; |
25
|
|
|
|
|
|
|
use Mouse v2.4.5; |
26
|
|
|
|
|
|
|
extends qw/Aniki/; |
27
|
|
|
|
|
|
|
with qw/Aniki::Plugin::WeightedRoundRobin/; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $db = MyDB->new(connect_info => [ |
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
value => [...], # Auguments for DBI's connect method. |
32
|
|
|
|
|
|
|
weight => 10, |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
{ |
35
|
|
|
|
|
|
|
value => [...], # Auguments for DBI's connect method. |
36
|
|
|
|
|
|
|
weight => 10, |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
]); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SEE ALSO |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
L<Data::WeightedRoundRobin> |
43
|
|
|
|
|
|
|
L<Aniki::Handler::WeightedRoundRobin> |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 LICENSE |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Copyright (C) karupanerura. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
50
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
karupanerura E<lt>karupa@cpan.orgE<gt> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |