line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Proc::Daemontools::Service::Test; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Proc::Daemontools::Service::Test |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
This is a simple service for testing. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
You probably don't want to use it. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
1830
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
16
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
66
|
|
17
|
2
|
|
|
2
|
|
10
|
use base qw(Proc::Daemontools::Service); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
1298
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 C<< svc_run >> |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 C<< svc_hangup >> |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 C<< svc_exit >> |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub svc_run { |
30
|
1
|
|
|
1
|
1
|
1000558
|
sleep 1 while 1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _write { |
34
|
2
|
|
|
2
|
|
5
|
my $str = shift; |
35
|
2
|
|
|
|
|
5
|
my $fh; |
36
|
2
|
50
|
|
|
|
429
|
open $fh, ">test.out" or die "Can't open test.out: $!"; |
37
|
2
|
|
|
|
|
37
|
print $fh $str; |
38
|
2
|
|
|
|
|
1002220
|
close $fh; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _read { |
42
|
2
|
|
|
2
|
|
2288002
|
my $fh; |
43
|
2
|
50
|
|
|
|
184
|
open $fh, "
|
44
|
2
|
|
|
|
|
66
|
my $line = <$fh>; |
45
|
2
|
|
|
|
|
31
|
close $fh; |
46
|
2
|
|
|
|
|
48
|
return $line; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub svc_hangup { |
50
|
1
|
|
|
1
|
1
|
5
|
_write("hangup"); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub svc_exit { |
54
|
1
|
|
|
1
|
1
|
6
|
_write("exit"); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |