| 1 | 14 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 14 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | package MooseX::Daemonize::Pid; | ||||||||||
| 4 | # ABSTRACT: PID management for MooseX::Daemonize | ||||||||||
| 5 | |||||||||||
| 6 | 14 | our $VERSION = '0.22'; | |||||||||
| 7 | |||||||||||
| 8 | 14 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 14 | ▶ | use Moose::Util::TypeConstraints qw(coerce from via); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 14 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | coerce 'MooseX::Daemonize::Pid' | ||||||||||
| 13 | => from 'Int' | ||||||||||
| 14 | 0 | ▶ | => via { MooseX::Daemonize::Pid->new( pid => $_ ) }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | has 'pid' => ( | ||||||||||
| 18 | is => 'rw', | ||||||||||
| 19 | isa => 'Int', | ||||||||||
| 20 | lazy => 1, | ||||||||||
| 21 | clearer => 'clear_pid', | ||||||||||
| 22 | predicate => 'has_pid', | ||||||||||
| 23 | 0 | ▶ | default => sub { $$ } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 24 | 14 | ); | |||||||||
| 25 | |||||||||||
| 26 | 11 | ▶ | sub is_running { kill(0, (shift)->pid) ? 1 : 0 } | ||||||||
|
Subroutine
is_running: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | 14 | __PACKAGE__->meta->make_immutable; | |||||||||
| 29 | 14 | 1; | |||||||||
| 30 | |||||||||||
| 31 | __END__ | ||||||||||
| 32 | |||||||||||
| 33 | =pod | ||||||||||
| 34 | |||||||||||
| 35 | =encoding UTF-8 | ||||||||||
| 36 | |||||||||||
| 37 | =head1 NAME | ||||||||||
| 38 | |||||||||||
| 39 | MooseX::Daemonize::Pid - PID management for MooseX::Daemonize | ||||||||||
| 40 | |||||||||||
| 41 | =head1 VERSION | ||||||||||
| 42 | |||||||||||
| 43 | version 0.22 | ||||||||||
| 44 | |||||||||||
| 45 | =head1 DESCRIPTION | ||||||||||
| 46 | |||||||||||
| 47 | This is a very basic Pid management object, it doesn't do all that | ||||||||||
| 48 | much, and mostly just serves as a base class for L<MooseX::Daemonize::Pid::File>. | ||||||||||
| 49 | |||||||||||
| 50 | =head1 ATTRIBUTES | ||||||||||
| 51 | |||||||||||
| 52 | =over 4 | ||||||||||
| 53 | |||||||||||
| 54 | =item I<pid Int> | ||||||||||
| 55 | |||||||||||
| 56 | =back | ||||||||||
| 57 | |||||||||||
| 58 | =head1 METHODS | ||||||||||
| 59 | |||||||||||
| 60 | =over 4 | ||||||||||
| 61 | |||||||||||
| 62 | =item B<clear_pid> | ||||||||||
| 63 | |||||||||||
| 64 | This will clear the value of the I<pid> attribute. It is useful for making sure | ||||||||||
| 65 | that the parent process does not have a bad value stored in it. | ||||||||||
| 66 | |||||||||||
| 67 | =item B<has_pid> | ||||||||||
| 68 | |||||||||||
| 69 | This is a predicate method to tell you if your I<pid> attribute has | ||||||||||
| 70 | been initialized yet. | ||||||||||
| 71 | |||||||||||
| 72 | =item B<is_running> | ||||||||||
| 73 | |||||||||||
| 74 | This checks to see if the I<pid> is running. | ||||||||||
| 75 | |||||||||||
| 76 | =item meta() | ||||||||||
| 77 | |||||||||||
| 78 | The C<meta()> method from L<Class::MOP::Class> | ||||||||||
| 79 | |||||||||||
| 80 | =back | ||||||||||
| 81 | |||||||||||
| 82 | =head1 SUPPORT | ||||||||||
| 83 | |||||||||||
| 84 | Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Daemonize> | ||||||||||
| 85 | (or L<bug-MooseX-Daemonize@rt.cpan.org|mailto:bug-MooseX-Daemonize@rt.cpan.org>). | ||||||||||
| 86 | |||||||||||
| 87 | There is also a mailing list available for users of this distribution, at | ||||||||||
| 88 | L<http://lists.perl.org/list/moose.html>. | ||||||||||
| 89 | |||||||||||
| 90 | There is also an irc channel available for users of this distribution, at | ||||||||||
| 91 | L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>. | ||||||||||
| 92 | |||||||||||
| 93 | =head1 AUTHORS | ||||||||||
| 94 | |||||||||||
| 95 | =over 4 | ||||||||||
| 96 | |||||||||||
| 97 | =item * | ||||||||||
| 98 | |||||||||||
| 99 | Stevan Little <stevan.little@iinteractive.com> | ||||||||||
| 100 | |||||||||||
| 101 | =item * | ||||||||||
| 102 | |||||||||||
| 103 | Chris Prather <chris@prather.org> | ||||||||||
| 104 | |||||||||||
| 105 | =back | ||||||||||
| 106 | |||||||||||
| 107 | =head1 COPYRIGHT AND LICENCE | ||||||||||
| 108 | |||||||||||
| 109 | This software is copyright (c) 2007 by Chris Prather. | ||||||||||
| 110 | |||||||||||
| 111 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 112 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 113 | |||||||||||
| 114 | =cut | ||||||||||