From: Stevan Little Date: Fri, 30 Nov 2007 01:53:56 +0000 (+0000) Subject: removing handles for pidfile, we need to make this into a role X-Git-Tag: 0_06~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Daemonize.git;a=commitdiff_plain;h=ff5cee29cf4f443df8f9efba4fa24464d34ded85 removing handles for pidfile, we need to make this into a role --- diff --git a/lib/MooseX/Daemonize.pm b/lib/MooseX/Daemonize.pm index 0cf7257..d3a8739 100644 --- a/lib/MooseX/Daemonize.pm +++ b/lib/MooseX/Daemonize.pm @@ -61,12 +61,6 @@ has pidfile => ( confess "Cannot write to $file" unless (-e $file ? -w $file : -w $_[0]->pidbase); MooseX::Daemonize::PidFile->new( file => $file ); }, - handles => { - check => 'running', - save_pid => 'write', - remove_pid => 'remove', - get_pid => 'pid', - }, ); has foreground => ( @@ -87,7 +81,7 @@ has stop_timeout => ( sub start { my ($self) = @_; - confess "instance already running" if $self->check; + confess "instance already running" if $self->pidfile->running; $self->daemonize unless $self->foreground; @@ -104,7 +98,7 @@ sub start { # Change to basedir chdir $self->basedir; - $self->save_pid; + $self->pidfile->write; $self->setup_signals; return $$; } @@ -114,9 +108,9 @@ my $_kill; sub stop { my ( $self, %args ) = @_; - my $pid = $self->get_pid; + my $pid = $self->pidfile->pid; $self->$_kill($pid) unless $self->foreground(); - $self->remove_pid; + $self->pidfile->remove; return 1 if $args{no_exit}; exit; } @@ -254,10 +248,6 @@ it. Defaults to 2 seconds =over -=item check() - -Check to see if an instance is already running. - =item start() Setup a pidfile, fork, then setup the signal handlers. @@ -289,18 +279,6 @@ Handle a INT signal, by default calls C<$self->stop()> Handle a HUP signal. By default calls C<$self->restart()> -=item get_pid - -Lookup the pid from our pidfile. - -=item save_pid - -Save the current pid in our pidfile - -=item remove_pid - -Delete our pidfile - =item meta() The C method from L