| 1 | package Ubic::Multiservice::Simple; | ||||||||||||||||||||||||||||
| 2 | 3 | $Ubic::Multiservice::Simple::VERSION = '1.59'; | |||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | # ABSTRACT: simplest multiservice, configured in constructor | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use Params::Validate qw(:all); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use parent qw(Ubic::Multiservice); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | sub new { | ||||||||||||||||||||||||||||
| 14 | 9 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | my ($params) = validate_pos(@_, { | ||||||||||||||||||||||||||||
| 16 | type => HASHREF, | ||||||||||||||||||||||||||||
| 17 | callbacks => { | ||||||||||||||||||||||||||||
| 18 | 'values are services' => sub { | ||||||||||||||||||||||||||||
| 19 | 9 | ▶ | for (values %{shift()}) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 20 | 12 | ▶ | return unless blessed($_) and $_->isa('Ubic::Service') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($_) and $_->isa("Ubic::Service")
MC/DC50%1/2
builtin::blessed($_) and $_->isa("Ubic::Service")
builtin::blessed($_)
$_->isa("Ubic::Service")
Truth table66%2/3
A and B
A= builtin::blessed($_)B= $_->isa("Ubic::Service")
| |||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | 8 | return 1; | |||||||||||||||||||||||||||
| 23 | }, | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | 9 | }); | |||||||||||||||||||||||||||
| 26 | 8 | return bless { services => $params } => $class; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | sub has_simple_service($$) { | ||||||||||||||||||||||||||||
| 30 | 8 | ▶ | my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
has_simple_service: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 8 | return exists $self->{services}{$name}; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | sub simple_service($$) { | ||||||||||||||||||||||||||||
| 35 | 14 | ▶ | my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
simple_service: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 14 | return $self->{services}{$name}; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | sub service_names($) { | ||||||||||||||||||||||||||||
| 40 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
service_names: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 41 | 3 | return keys %{ $self->{services} }; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | sub multiop { | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | return 'allowed'; # simple multiservices are usually simple enough to allow multiservice-wide actions by default | ||||||||||||||||||||||||||
|
Subroutine
multiop: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 3 | 1; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | __END__ | ||||||||||||||||||||||||||||