line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ubic::Multiservice::Simple; |
2
|
|
|
|
|
|
|
$Ubic::Multiservice::Simple::VERSION = '1.60'; |
3
|
3
|
|
|
3
|
|
46357
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
65
|
|
4
|
3
|
|
|
3
|
|
8
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
63
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: simplest multiservice, configured in constructor |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
829
|
use Params::Validate qw(:all); |
|
3
|
|
|
|
|
10633
|
|
|
3
|
|
|
|
|
387
|
|
10
|
3
|
|
|
3
|
|
13
|
use Scalar::Util qw(blessed); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
160
|
|
11
|
3
|
|
|
3
|
|
363
|
use parent qw(Ubic::Multiservice); |
|
3
|
|
|
|
|
204
|
|
|
3
|
|
|
|
|
11
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
9
|
|
|
9
|
1
|
1959
|
my $class = shift; |
15
|
|
|
|
|
|
|
my ($params) = validate_pos(@_, { |
16
|
|
|
|
|
|
|
type => HASHREF, |
17
|
|
|
|
|
|
|
callbacks => { |
18
|
|
|
|
|
|
|
'values are services' => sub { |
19
|
9
|
|
|
9
|
|
28
|
for (values %{shift()}) { |
|
9
|
|
|
|
|
18
|
|
20
|
13
|
100
|
66
|
|
|
272
|
return unless blessed($_) and $_->isa('Ubic::Service') |
21
|
|
|
|
|
|
|
} |
22
|
8
|
|
|
|
|
22
|
return 1; |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
} |
25
|
9
|
|
|
|
|
90
|
}); |
26
|
8
|
|
|
|
|
44
|
return bless { services => $params } => $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub has_simple_service($$) { |
30
|
8
|
|
|
8
|
1
|
9
|
my ($self, $name) = @_; |
31
|
8
|
|
|
|
|
36
|
return exists $self->{services}{$name}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub simple_service($$) { |
35
|
14
|
|
|
14
|
1
|
14
|
my ($self, $name) = @_; |
36
|
14
|
|
|
|
|
23
|
return $self->{services}{$name}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub service_names($) { |
40
|
3
|
|
|
3
|
1
|
3
|
my $self = shift; |
41
|
3
|
|
|
|
|
2
|
return keys %{ $self->{services} }; |
|
3
|
|
|
|
|
16
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub multiop { |
45
|
0
|
|
|
0
|
1
|
|
return 'allowed'; # simple multiservices are usually simple enough to allow multiservice-wide actions by default |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |