package MooseX::Daemonize::Pid::File;
use strict; # because Kwalitee is pedantic
use Moose;
+use Moose::Util::TypeConstraints;
+use MooseX::Types::Path::Class;
-use MooseX::Daemonize::Types;
+coerce 'MooseX::Daemonize::Pid::File'
+ => from 'Str'
+ => via { MooseX::Daemonize::Pid::File->new( file => $_ ) }
+ => from 'Path::Class::File'
+ => via { MooseX::Daemonize::Pid::File->new( file => $_ ) };
our $VERSION = '0.01';
sub write {
my $self = shift;
- $self->file->openw->print($self->pid);
+ my $fh = $self->file->openw;
+ $fh->print($self->pid);
+ $fh->close;
}
override 'is_running' => sub {
=over
-=item pid Int
-
=item file Path::Class::File | Str
=back