| 1 | package HTTP::Balancer::Model::Host; | ||
| 2 | 2 | ▶ | use Modern::Perl; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use MooseX::Storage; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | extends qw( HTTP::Balancer::Model ); | |
| 6 | |||
| 7 | 2 | with Storage( | |
| 8 | format => 'YAML', | ||
| 9 | io => 'File', | ||
| 10 | ); | ||
| 11 | |||
| 12 | 2 | has [qw(id port)] => ( | |
| 13 | is => "rw", | ||
| 14 | isa => "Num", | ||
| 15 | ); | ||
| 16 | |||
| 17 | 2 | has [qw(name fullname address)] => ( | |
| 18 | is => "rw", | ||
| 19 | isa => "Str", | ||
| 20 | ); | ||
| 21 | |||
| 22 | 0 | ▶ | before remove => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 23 | 0 | my $self = shift; | |
| 24 | 0 | map { say $_->remove } $self->backends; | |
| 25 | 2 | }; | |
| 26 | |||
| 27 | 0 | ▶ | sub backends { |
|
Subroutine
backends: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 28 | 0 | my ($self, ) = @_; | |
| 29 | 0 | $self->model("Backend") | |
| 30 | ->where(host_id => $self->id); | ||
| 31 | } | ||
| 32 | |||
| 33 | 0 | ▶ | sub hash { |
|
Subroutine
hash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 34 | 0 | my ($self, ) = @_; | |
| 35 | return { | ||
| 36 | name => $self->name, | ||
| 37 | fullname => $self->fullname, | ||
| 38 | address => $self->address, | ||
| 39 | port => $self->port, | ||
| 40 | 0 | backends => [map {$_->address . ":" . $_->port} $self->backends], | |
| 41 | }; | ||
| 42 | } | ||
| 43 | |||
| 44 | 2 | 1; | |
| 45 | __END__ | ||