| 1 | package Helm::Server; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | has name => (is => 'ro', writer => '_name', isa => 'Str', required => 1); | |||||||||
| 7 | 1 | has name_length => (is => 'ro', writer => '_name_length', isa => 'Str'); | |||||||||
| 8 | 0 | ▶ | has roles => (is => 'ro', writer => '_roles', isa => 'ArrayRef[Str]', default => sub { [] }); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 9 | 1 | has port => (is => 'ro', writer => '_port', isa => 'Int|Undef'); | |||||||||
| 10 | |||||||||||
| 11 | # stringify to it's name | ||||||||||
| 12 | use overload | ||||||||||
| 13 | 0 | ▶ | '""' => sub { shift->name }, | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 14 | 1 | fallback => 1; | |||||||||
| 15 | |||||||||||
| 16 | 0 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 17 | 0 | my $self = shift; | |||||||||
| 18 | 0 | $self->_name_length(length $self->name); | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 0 | ▶ | sub has_role { | ||||||||
|
Subroutine
has_role: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 22 | 0 | my ($self, @possible_roles) = @_; | |||||||||
| 23 | 0 | foreach my $role (@{$self->roles}) { | |||||||||
| 24 | 0 | foreach my $possible (@possible_roles) { | |||||||||
| 25 | 0 | ▶ | return 1 if $possible eq $role; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | } | ||||||||||
| 27 | } | ||||||||||
| 28 | 0 | return 0; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | sub expand_server_names { | ||||||||
|
Subroutine
expand_server_names: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 32 | 0 | my ($self, @names) = @_; | |||||||||
| 33 | 0 | my @expanded; | |||||||||
| 34 | 0 | foreach my $name (@names) { | |||||||||
| 35 | 0 | ▶ | if( $name =~ /\[(\d+)\-(\d+)\]/ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | my $start = $1; | |||||||||
| 37 | 0 | my $end = $2; | |||||||||
| 38 | 0 | for my $i ($start .. $end) { | |||||||||
| 39 | 0 | (my $new_name = $name) =~ s/\[\d+\-\d+\]/$i/; | |||||||||
| 40 | 0 | push(@expanded, $new_name); | |||||||||
| 41 | } | ||||||||||
| 42 | } else { | ||||||||||
| 43 | 0 | push(@expanded, $name); | |||||||||
| 44 | } | ||||||||||
| 45 | } | ||||||||||
| 46 | 0 | return @expanded; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 50 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 51 | |||||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||