The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Zing::Daemon - Process Daemon

ABSTRACT

Daemon Process Management

SYNOPSIS

  use Zing;
  use Zing::Daemon;

  my $scheme = ['MyApp', [], 1];
  my $daemon = Zing::Daemon->new(name => 'app', app => Zing->new(scheme => $scheme));

  # $daemon->start;

DESCRIPTION

This package provides the mechanisms for running a Zing application as a daemon process.

LIBRARIES

This package uses type constraints from:

Zing::Types

ATTRIBUTES

This package has the following attributes:

app

  app(Zing)

This attribute is read-only, accepts (Zing) values, and is required.

log

  log(Logger)

This attribute is read-only, accepts (Logger) values, and is optional.

name

  name(Str)

This attribute is read-only, accepts (Str) values, and is required.

pid_dir

  pid_dir(Str)

This attribute is read-only, accepts (Str) values, and is optional.

pid_file

  pid_file(Str)

This attribute is read-only, accepts (Str) values, and is optional.

pid_path

  pid_path(Str)

This attribute is read-only, accepts (Str) values, and is optional.

METHODS

This package implements the following methods:

execute

  execute() : Int

The execute method forks the application and creates a pid file under the "pid_path".

execute example #1
  # given: synopsis

  my $exit = $daemon->execute;

fork

  fork() : Int

The fork method forks the application and returns a pid.

fork example #1
  # given: synopsis

  my $pid = $daemon->fork;

start

  start() : Any

The start method executes the application and exits the program with the proper exit code.

start example #1
  # given: synopsis

  $daemon->start;

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues