Balancer/Actor/Nginx.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 28 CC 2 SCAR 12.0
CC
2
Cov
0%
stop
6.0
start
2.0
BEGIN
2.0
CRAP 3.3
1 package HTTP::Balancer::Actor::Nginx;
2 use Modern::Perl;
3 use Moose;
4 extends qw(HTTP::Balancer::Actor);
5  
6 use Path::Tiny;
7  
8 our $NAME = "nginx";
9  
10 sub start {
11 my ($self, %params) = @_;
12 my $tempfile = Path::Tiny->tempfile(TEMPLATE => "http-balancer-XXXX");
13 $tempfile->spew($self->render(%params));
14 system $self->executable . " -c " . $tempfile->stringify;
15 }
16  
17 sub stop {
18 my ($self, %params) = @_;
19 my $pidfile = path($params{pidfile});
20 $pidfile->exists ? $self->kill($pidfile->slurp) : say "not running";
21 }
22  
23 1;
24  
25 =pod
26  
27 =head1 NAME
28  
29 HTTP::Balancer::Actor::Nginx - the Nginx actor
30  
31 =head1 SYNOPSIS
32  
33 my $actor = HTTP::Balancer::Actor::Nginx->new;
34  
35 $actor->start(
36 pidfile => "/tmp/http-balancer.pid",
37 hosts => [
38 $host1->hash,
39 $host2->hash,
40 ],
41 );
42  
43 $actor->stop(
44 pidfile => "/tmp/http-balancer.pid",
45 );
46  
47 =cut
48  
49 __DATA__