NAME
Module::Build::Service::Fork - Role for process handling in service implementations
VERSION
version 0.91
SYNOPSIS
package Module::Build::Service::foo;
use Moo;
extends 'Module::Build::Service::Base';
with 'Module::Build::Service::Fork';
sub _build_command {
my ($self) = @_;
[$self->bin, qw{-f flag1 -g flag2 -h}];
}
sub _build_log { ',,foo.log' }
sub _build_executable { 'foo' }
DESCRIPTION
This is a role that tries to factor out a lot of boilerplate in defining services that involve forking an executable to run the service.
ATTRIBUTES
bin
The full path to the binary executable for starting the service.
If this is not specified, we search for executable in path.
command
The command-line for the executable. Each class including the role must define it, as there is no sensible default.
executable
The bare name of the executable that is run to start the service. Defaults to service_name
.
If you specify bin
directly (either in a parameter to new
, or by overriding _build_bin), you don't actually need to specify this unless you use it yourself, as it is only used when trying to generate bin automatically.
path
The list of directories in which we should search for the executable. The default is /usr/sbin
and /usr/local/sbin
.
If you specify bin
directly (either in a parameter to new
, or by overriding _build_bin), you don't actually need to specify this unless you use it yourself, as it is only used when trying to generate bin automatically.
METHODS
start_service
A default implementation of start_service
that starts the contents of command
.
stop_service
A default implementation of stop_service
that just terminates the child process. Generally adequate. It can be overridden or modified as appropriate.
AUTHOR
Michael Alan Dorman <mdorman@ironicdesign.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ironic Design, Inc..
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.