Working::Daemon - Perl extension for turning your script inta daemon.


Working-Daemon documentation  | view source Contained in the Working-Daemon distribution.

Index


NAME

Top

Working::Daemon - Perl extension for turning your script inta daemon.

SYNOPSIS

Top

  use Working::Daemon;
  our $VERSION = 0.45;
  my $daemon = Working::Daemon->new();
  $daemon->name("testdaemon");
  $daemon->standard("bool"      => 1 => "Test if you can set bools",
                    "integer=i" => 2323 => "Integer settings",
                    "string=s"  => string => "String setting",
                    "multi=s%"  => undef() => "Multiset variable");

Or

  use Working::Daemon;
  our $VERSION = 0.45;
  my $daemon = Working::Daemon->new();
  $daemon->name("testdaemon");
  $daemon->user("foo");
  $daemon->parse_options("myoption" => "sets myoption!");
  $daemon->do_action;

  # only the worker continues to from here
  $self->change_root;
  $self->drop_privs;

  # your app codefrom here

DESCRIPTION

Top

This is a modular Daemon wrapper. It handles forking, master session, chroot pidfiles, and command line parsing.

While it isn't perfect yet, it works better than any existing on CPAN. Notably it doesn't force itself on you unconditionally.

The commandline parsing uses Getopt::Long

It also supports start,stop,status and restart. So you can symlink your daemon directly into init.d

SEE ALSO

Top

AUTHOR

Top

Artur Bergman, <sky+cpan@crucially.net@>

COPYRIGHT AND LICENSE

Top


Working-Daemon documentation  | view source Contained in the Working-Daemon distribution.