line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Balancer::Role; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
HTTP::Balancer::Role - base of all roles in HTTP::Balancer |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package HTTP::Balancer::Role::Any; |
10
|
|
|
|
|
|
|
use Modern::Perl; |
11
|
|
|
|
|
|
|
use Moose::Role; |
12
|
|
|
|
|
|
|
with qw(HTTP::Balancer::Role); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# your code goes here |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
no Moose::Role; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
5
|
use Modern::Perl; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
805
|
use Moose::Role; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 model($name) |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
given the last name of a model, returns the whole name of the model, and requires this model. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub model { |
31
|
|
|
|
|
|
|
my ($self, $name) = @_; |
32
|
|
|
|
|
|
|
$name = ucfirst($name); |
33
|
|
|
|
|
|
|
my $model = "HTTP::Balancer::Model::$name"; |
34
|
|
|
|
|
|
|
eval qq{use $model}; |
35
|
|
|
|
|
|
|
die $@ if $@; |
36
|
|
|
|
|
|
|
return $model; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 actor($name) |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub actor { |
44
|
|
|
|
|
|
|
my ($self, $name) = @_; |
45
|
|
|
|
|
|
|
$name = ucfirst($name); |
46
|
|
|
|
|
|
|
my $actor = "HTTP::Balancer::Actor::$name"; |
47
|
|
|
|
|
|
|
eval qq{use $actor}; |
48
|
|
|
|
|
|
|
die $@ if $@; |
49
|
|
|
|
|
|
|
return $actor; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 config() |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
return the singleton of the configuration. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
use HTTP::Balancer::Config; |
59
|
|
|
|
|
|
|
sub config { |
60
|
|
|
|
|
|
|
return HTTP::Balancer::Config->instance; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
no Moose::Role; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=pod |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
HTTP::Balancer::Role - base of all roles of HTTP::Balancer |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SYNOPSIS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
package HTTP::Balancer::Role::Foo; |
76
|
|
|
|
|
|
|
use Moose::Role; |
77
|
|
|
|
|
|
|
with qw( HTTP::Balancer::Role ); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |