X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FDaemonize%2FPid%2FFile.pm;h=06bd5dc310d98e68e1d30c21462cfbf5bfe5c43c;hb=92cf56b7c3fd91568e4b964319a7862fc4f1d651;hp=2b3c88af2f4f99375d46d7fe74ebf365e184d395;hpb=8ac4733fe6918fb1449262f56b5c371315c6cfb8;p=gitmo%2FMooseX-Daemonize.git diff --git a/lib/MooseX/Daemonize/Pid/File.pm b/lib/MooseX/Daemonize/Pid/File.pm index 2b3c88a..06bd5dc 100644 --- a/lib/MooseX/Daemonize/Pid/File.pm +++ b/lib/MooseX/Daemonize/Pid/File.pm @@ -2,15 +2,31 @@ package MooseX::Daemonize::Pid::File; use strict; # because Kwalitee is pedantic use Moose; use Moose::Util::TypeConstraints; + +our $VERSION = '0.01'; + use MooseX::Types::Path::Class; +use MooseX::Getopt::OptionTypeMap; +# NOTE: +# set up some basic coercions +# that will come in handy +# - SL coerce 'MooseX::Daemonize::Pid::File' => from 'Str' => via { MooseX::Daemonize::Pid::File->new( file => $_ ) } + => from 'ArrayRef' + => via { MooseX::Daemonize::Pid::File->new( file => $_ ) } => from 'Path::Class::File' => via { MooseX::Daemonize::Pid::File->new( file => $_ ) }; - -our $VERSION = '0.01'; + +# NOTE: +# make sure this class plays +# well with MooseX::Getopt +# - SL +MooseX::Getopt::OptionTypeMap->add_option_type_to_map( + 'MooseX::Daemonize::Pid::File' => '=s', +); extends 'MooseX::Daemonize::Pid'; @@ -54,16 +70,29 @@ __END__ =head1 NAME MooseX::Daemonize::Pid::File - PID file management for MooseX::Daemonize - -=head1 SYNOPSIS =head1 DESCRIPTION +This object extends L to add persistence in a Pidfile. + +This class sets up some basic coercion routines for itself so that it can +be created from a I (a file name), I (an array of path components +for a filename) or a I object. + +This class registers it's type with L as well, and is expected +to be passed on the command line as a string (which will then go through the +coercion routines mentioned above). + =head1 ATTRIBUTES =over -=item file Path::Class::File | Str +=item I + +This is inherited from L and extended here to +get it's default value from the Pidfile (if available). + +=item I =back @@ -71,13 +100,29 @@ MooseX::Daemonize::Pid::File - PID file management for MooseX::Daemonize =over -=item remove +=item B + +=item B + +Both of these methods are inherited from L see that +module for more information. + +=item B + +This removes the Pidfile. + +=item B + +This writes the Pidfile. + +=item B -=item write +This checks if the Pidfile exists. -=item does_file_exist +=item B -=item is_running +This checks if the Pidfile exists, if it does it checks to see if the process +is running, if the Pidfile doesn't exist, it returns false. =item meta() @@ -103,7 +148,7 @@ L. =head1 AUTHOR -Stevan Little C<< >> +Stevan Little C<< >> =head1 LICENCE AND COPYRIGHT