X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FDaemonize.pm;h=d0c60c612de0035c165ba8186fb8ff9b83cf6c22;hb=105dcffad5ce6cde49886d0f88209f2d54a8a86d;hp=5c627bac6eb8670831adf583d419d09a02b964ef;hpb=05b96f4d04d93f2344602f7b3ef43da01c0a2794;p=gitmo%2FMooseX-Daemonize.git diff --git a/lib/MooseX/Daemonize.pm b/lib/MooseX/Daemonize.pm index 5c627ba..d0c60c6 100644 --- a/lib/MooseX/Daemonize.pm +++ b/lib/MooseX/Daemonize.pm @@ -2,8 +2,9 @@ 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'; +our $VERSION = '0.15'; with 'MooseX::Daemonize::WithPidFile', 'MooseX::Getopt'; @@ -81,6 +82,15 @@ has exit_code => ( sub init_pidfile { my $self = shift; my $file = $self->pidbase . '/' . $self->progname . '.pid'; + + if ( !-d $self->pidbase ) { + make_path( $self->pidbase, { error => \my $err } ); + if (@$err) { + confess sprintf( "Cannot create pidbase directory '%s': %s", + $self->pidbase, @$err ); + } + } + confess "Cannot write to $file" unless (-e $file ? -w $file : -w $self->pidbase); MooseX::Daemonize::Pid::File->new( file => $file ); } @@ -304,7 +314,11 @@ MooseX::Daemonize - Role for daemonizing your Moose based application =head1 VERSION -This document describes MooseX::Daemonize version 0.05 +This document describes MooseX::Daemonize version 0.15 + +=head1 WARNING + +The maintainers of this module now recommend using L instead. =head1 SYNOPSIS @@ -559,7 +573,7 @@ L. =head1 SEE ALSO -L, L +L, L, L =head1 AUTHORS