File Coverage

tfiles/service/slow-service
Criterion Covered Total %
statement 12 14 85.7
branch 2 2 100.0
condition n/a
subroutine 5 7 71.4
pod n/a
total 19 23 82.6


line stmt bran cond sub pod time code
1             # vim: ft=perl
2              
3 4     4   29 use parent qw(Ubic::Service::Skeleton);
  4         4  
  4         24  
4 4     4   1168 use Ubic::Daemon qw(:all);
  4         7  
  4         21  
5              
6             my $pidfile = 'tfiles/slow.pid';
7              
8             sub new {
9 4     4   33 return bless {} => shift;
10             }
11              
12             sub start_impl {
13 3     3   24 start_daemon({
14             bin => 'sleep 1000',
15             pidfile => $pidfile,
16             });
17             }
18              
19             sub stop_impl {
20 0     0   0 stop_daemon($pidfile);
21             }
22              
23             sub status_impl {
24 5     5   10000983 sleep 2;
25 5 100       99 if (check_daemon($pidfile)) {
26 2         16 return 'running';
27             }
28             else {
29 3         18 return 'not running';
30             }
31             }
32              
33             sub check_timeout {
34 0     0     return 1;
35             }
36              
37             return __PACKAGE__->new;