lib/Ubic/Multiservice/Simple.pm

filter: Statementstmt 96.8% 31 / 32 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 90.9% 10 / 11 Podpod 100% 5 / 5 totaltotal 92.7% 51 / 55 SCAR 13.9
CC
4
Cov
95%
__ANON__
4.0
multiop
2.0
new
1.0
CRAP 4.0
« lib/Ubic/Persistent.pm ↑ Summary lib/Ubic/ServiceLoader.pm »
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
BranchTrueFalseTotal
unless builtin::blessed($_) and $_->isa("Ubic::Service") 1 11 12
Condition66%2/3
builtin::blessed($_) and $_->isa("Ubic::Service")
!ll&&!rl&&r
1011
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")
ABresult
0X0
100
111
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__
« lib/Ubic/Persistent.pm ↑ Summary lib/Ubic/ServiceLoader.pm »