repository moved to https://github.com/moose/MooseX-Daemonize
[gitmo/MooseX-Daemonize.git] / lib / MooseX / Daemonize.pm
index 7a8c3c6..347cd69 100644 (file)
@@ -1,10 +1,11 @@
+use strict;
+use warnings;
 package MooseX::Daemonize;
-use strict;    # because Kwalitee is pedantic
+
 use Moose::Role;
 use MooseX::Types::Path::Class;
 use File::Path qw(make_path);
-
-our $VERSION   = '0.13';
+use namespace::autoclean;
 
 with 'MooseX::Daemonize::WithPidFile',
      'MooseX::Getopt';
@@ -22,6 +23,7 @@ has progname => (
         ( my $name = lc $_[0]->meta->name ) =~ s/::/_/g;
         return $name;
     },
+    documentation => 'the name of the daemon',
 );
 
 has pidbase => (
@@ -32,6 +34,7 @@ has pidbase => (
     required  => 1,
     lazy      => 1,
     default   => sub { Path::Class::Dir->new('', 'var', 'run') },
+    documentation => 'the base for our pid (default: /var/run)',
 );
 
 has basedir => (
@@ -42,6 +45,7 @@ has basedir => (
     required  => 1,
     lazy      => 1,
     default   => sub { Path::Class::Dir->new('/') },
+    documentation => 'the directory to chdir to (default: /)',
 );
 
 has foreground => (
@@ -50,13 +54,15 @@ has foreground => (
     isa         => 'Bool',
     is          => 'ro',
     default     => sub { 0 },
+    documentation => 'if true, the process won\'t background',
 );
 
 has stop_timeout => (
     metaclass => 'Getopt',
     isa       => 'Int',
     is        => 'rw',
-    default   => sub { 2 }
+    default   => sub { 2 },
+    documentation => 'number of seconds to wait for the process to stop, before trying harder to kill it (default: 2 s)',
 );
 
 # internal book-keeping
@@ -210,7 +216,7 @@ sub stop {
     $self->clear_exit_code;
 
     # if the pid is not running
-    # then we dont need to stop
+    # then we don't need to stop
     # anything ...
     if ($self->pidfile->is_running) {
 
@@ -312,9 +318,9 @@ __END__
 
 MooseX::Daemonize - Role for daemonizing your Moose based application
 
-=head1 VERSION
+=head1 WARNING
 
-This document describes MooseX::Daemonize version 0.05
+The maintainers of this module now recommend using L<Daemon::Control> instead.
 
 =head1 SYNOPSIS
 
@@ -348,7 +354,7 @@ This document describes MooseX::Daemonize version 0.05
 
 =head1 DESCRIPTION
 
-Often you want to write a persistant daemon that has a pid file, and responds
+Often you want to write a persistent daemon that has a pid file, and responds
 appropriately to Signals. This module provides a set of basic roles as an
 infrastructure to do that.
 
@@ -391,6 +397,10 @@ The name of our daemon, defaults to C<$package_name =~ s/::/_/>;
 
 The base for our PID, defaults to C</var/run/>
 
+=item I<basedir Path::Class::Dir | Str>
+
+The directory we chdir to; defaults to C</>.
+
 =item I<pidfile MooseX::Daemonize::Pid::File | Str>
 
 The file we store our PID in, defaults to C<$pidbase/$progname.pid>
@@ -403,7 +413,7 @@ be set via Getopt's -f.
 =item I<no_double_fork Bool>
 
 If true, the process will not perform the typical double-fork, which is extra
-added protection from your process accidentally aquiring a controlling terminal.
+added protection from your process accidentally acquiring a controlling terminal.
 More information can be found by Googling "double fork daemonize".
 
 =item I<ignore_zombies Bool>
@@ -527,7 +537,7 @@ Handle a HUP signal. By default calls C<$self->restart()>
 
 =head2 Exit Code Methods
 
-These are overriable constant methods used for setting the exit code.
+These are overridable constant methods used for setting the exit code.
 
 =over 4
 
@@ -564,12 +574,12 @@ None reported. Although obviously this will not work on Windows.
 No bugs have been reported.
 
 Please report any bugs or feature requests to
-C<bug-acme-dahut-call@rt.cpan.org>, or through the web interface at
+C<bug-MooseX-Daemonize@rt.cpan.org>, or through the web interface at
 L<http://rt.cpan.org>.
 
 =head1 SEE ALSO
 
-L<Proc::Daemon>, L<Daemon::Generic>
+L<Daemon::Control>, L<Proc::Daemon>, L<Daemon::Generic>
 
 =head1 AUTHORS