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