Artur Bergman > Working-Daemon-0.31 > Working::Daemon

Download:
Working-Daemon-0.31.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.31   Source  

NAME ^

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

SYNOPSIS ^

  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 ^

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 ^

AUTHOR ^

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

COPYRIGHT AND LICENSE ^

Copyright (C) 2008 by Artur Bergman

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: