line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::PS1::Daemon; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2011-06-21 09:47:54 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1420
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
10
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
11
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
69
|
|
12
|
1
|
|
|
1
|
|
6
|
use Data::Dumper qw/Dumper/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
13
|
1
|
|
|
1
|
|
14
|
use English qw/ -no_match_vars /; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
14
|
1
|
|
|
1
|
|
443
|
use base qw/Class::Accessor::Fast/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
234
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = 0.08; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
0
|
|
|
0
|
1
|
|
my $caller = shift; |
20
|
0
|
0
|
|
|
|
|
my $class = ref $caller ? ref $caller : $caller; |
21
|
0
|
|
|
|
|
|
my %param = @_; |
22
|
0
|
|
|
|
|
|
my $self = \%param; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
bless $self, $class; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
App::PS1::Daemon - Gets info that can take a long time to collect so the app_ps1 command can have the data pre-populated |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 VERSION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This documentation refers to App::PS1::Daemon version 0.08. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
use App::PS1::Daemon; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Brief but working code example(s) here showing the most common usage(s) |
46
|
|
|
|
|
|
|
# This section will be as far as many users bother reading, so make it as |
47
|
|
|
|
|
|
|
# educational and exemplary as possible. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 DESCRIPTION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This module starts a deamon process (if one doesn't already exist) and |
53
|
|
|
|
|
|
|
communicates with that process. The aim of which is to make sure things plugins |
54
|
|
|
|
|
|
|
that can take a long time run (eg getting process counts when there are many |
55
|
|
|
|
|
|
|
processes running on a system) can do their work at either regular intervals |
56
|
|
|
|
|
|
|
or by triggered events and just hand the pre-processed results back to the |
57
|
|
|
|
|
|
|
app_ps1 command. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 TODO |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Everything. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
* Create an event driven deamon |
64
|
|
|
|
|
|
|
* Work out how to talk to said deamon |
65
|
|
|
|
|
|
|
* Make sure there is only one deamon running at a time per user |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 C<new ( $search, )> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Param: C<$search> - type (detail) - description |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Return: App::PS1::Daemon - |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Description: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
There are no known bugs in this module. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Patches are welcome. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHOR |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Copyright (c) 2011 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
100
|
|
|
|
|
|
|
All rights reserved. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
103
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
104
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
105
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
106
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |