lib/Ubic/Service.pm

filter: Statementstmt 75.0% 33 / 44 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 63.1% 12 / 19 Podpod 100% 15 / 15 totaltotal 78.5% 66 / 84 SCAR 14.3
CC
4
Cov
78%
start
2.0
stop
2.0
status
2.0
CRAP 4.2
« lib/Ubic/Lockf/Alarm.pm ↑ Summary lib/Ubic/Persistent.pm »
1 package Ubic::Service;
2 157 $Ubic::Service::VERSION = '1.59';
3 157 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 157 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 157 ▶use Ubic::Settings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # ABSTRACT: interface and the base class for any ubic service
9  
10  
11 157 ▶use Ubic::Result qw(result);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub start {
14 0 ▶ die "not implemented";
Subroutine start: not called CC=1 SCAR=6.9
Pod documented
15 }
16  
17 sub stop {
18 0 ▶ die "not implemented";
Subroutine stop: not called CC=1 SCAR=6.9
Pod documented
19 }
20  
21 sub status {
22 0 ▶ my ($self) = @_;
Subroutine status: not called CC=1 SCAR=6.9
Pod documented
23 0 die "not implemented";
24 }
25  
26 sub reload {
27 0 ▶ my ($self) = @_;
Subroutine reload: not called CC=1 SCAR=6.9
Pod documented
28 0 return result('unknown', 'not implemented');
29 }
30  
31 sub port {
32 0 ▶ my ($self) = @_;
Subroutine port: not called CC=1 SCAR=6.9
Pod documented
33 0 return; # by default, service has no port
34 }
35  
36 sub user {
37 516 ▶ my $self = shift;
Subroutine user: called CC=1 SCAR=0.0
Pod documented
38 516 return Ubic::Settings->default_user;
39 }
40  
41 sub group {
42 514 ▶ return ();
Subroutine group: called CC=1 SCAR=0.0
Pod documented
43 }
44  
45 sub check_period {
46 0 ▶ my ($self) = @_;
Subroutine check_period: not called CC=1 SCAR=6.9
Pod documented
47 0 return 60;
48 }
49  
50 sub check_timeout {
51 78 ▶ return 60;
Subroutine check_timeout: called CC=1 SCAR=0.0
Pod documented
52 }
53  
54 sub custom_commands {
55 5 ▶ return ();
Subroutine custom_commands: called CC=1 SCAR=0.0
Pod documented
56 }
57  
58 sub do_custom_command {
59 0 ▶ die "No such command";
Subroutine do_custom_command: not called CC=1 SCAR=6.9
Pod documented
60 }
61  
62 sub name($;$) {
63 5353 ▶ my ($self, $name) = @_;
Subroutine name: called CC=2 SCAR=6.9
Pod documented
64 5353 ▶ if (defined $name) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $name) { } 1345 4008 5353
65 1345 $self->{name} = $name;
66 }
67 else {
68 4008 return $self->{name};
69 }
70 }
71  
72 sub full_name($) {
73 2638 ▶ my ($self) = @_;
Subroutine full_name: called CC=2 SCAR=6.9
Pod documented
74 2638 my $parent_name = $self->parent_name;
75 2638 ▶ if (defined $parent_name) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $parent_name) { } 426 2212 2638
76 426 return $parent_name.".".$self->name;
77 }
78 else {
79 2212 return $self->name;
80 }
81 }
82  
83 sub parent_name($;$) {
84 3990 ▶ my ($self, $name) = @_;
Subroutine parent_name: called CC=2 SCAR=6.9
Pod documented
85 3990 ▶ if (defined $name) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $name) { } 426 3564 3990
86 426 $self->{parent_name} = $name;
87 }
88 else {
89 3564 return $self->{parent_name};
90 }
91 }
92  
93 sub auto_start($) {
94 36 ▶ return 0;
Subroutine auto_start: called CC=1 SCAR=0.0
Pod documented
95 }
96  
97  
98 157 1;
99  
100 __END__
« lib/Ubic/Lockf/Alarm.pm ↑ Summary lib/Ubic/Persistent.pm »