| 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 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 3 | ▶ | use base qw(Proc::Daemontools::Service); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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 | 1 | ▶ | sub svc_run { | ||||||||
|
Subroutine
svc_run: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 30 | 1 | sleep 1 while 1; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 2 | ▶ | sub _write { | ||||||||
|
Subroutine
_write: called CC=2 SCAR=7.0
| |||||||||||
| 34 | 2 | my $str = shift; | |||||||||
| 35 | 2 | my $fh; | |||||||||
| 36 | 2 | ▶ | open $fh, ">test.out" or die "Can't open test.out: $!"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 2 | print $fh $str; | |||||||||
| 38 | 2 | close $fh; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 2 | ▶ | sub _read { | ||||||||
|
Subroutine
_read: called CC=2 SCAR=7.0
| |||||||||||
| 42 | 2 | my $fh; | |||||||||
| 43 | 2 | ▶ | open $fh, "<test.out" or die "Can't open test.out: $!"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 2 | my $line = <$fh>; | |||||||||
| 45 | 2 | close $fh; | |||||||||
| 46 | 2 | return $line; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 1 | ▶ | sub svc_hangup { | ||||||||
|
Subroutine
svc_hangup: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 50 | 1 | _write("hangup"); | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 1 | ▶ | sub svc_exit { | ||||||||
|
Subroutine
svc_exit: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 54 | 1 | _write("exit"); | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 3 | 1; | |||||||||