File Coverage

blib/lib/XAS/Lib/App/Service/Unix.pm
Criterion Covered Total %
statement 6 15 40.0
branch 0 2 0.0
condition n/a
subroutine 2 6 33.3
pod 4 4 100.0
total 12 27 44.4


line stmt bran cond sub pod time code
1             package XAS::Lib::App::Service::Unix;
2              
3             our $VERSION = '0.01';
4              
5 1     1   630 use POE;
  1         1  
  1         9  
6              
7             use XAS::Class
8 1         15 debug => 0,
9             version => $VERSION,
10             base => 'XAS::Base',
11             utils => 'daemonize dotid',
12             mixins => 'define_daemon get_service_config
13             install_service remove_service',
14 1     1   266 ;
  1         1  
15              
16             # ----------------------------------------------------------------------
17             # Public Methods
18             # ----------------------------------------------------------------------
19              
20             sub define_daemon {
21 0     0 1   my $self = shift;
22              
23             # become a daemon...
24             # interesting, "daemonize() if ($self->daemon);" doesn't work as expected
25              
26 0           $self->log->debug("pid = $$");
27              
28 0 0         if ($self->daemon) {
29              
30 0           daemonize();
31 0           $poe_kernel->has_forked();
32              
33             }
34              
35 0           $self->log->debug("pid = $$");
36              
37             }
38              
39             sub get_service_config {
40 0     0 1   my $self = shift;
41              
42             }
43              
44             sub install_service {
45 0     0 1   my $self = shift;
46              
47             }
48              
49             sub remove_service {
50 0     0 1   my $self = shift;
51              
52             }
53              
54             # ----------------------------------------------------------------------
55             # Private Methods
56             # ----------------------------------------------------------------------
57              
58             1;
59              
60             __END__
61              
62             =head1 NAME
63              
64             XAS::Lib::App::Service::Unix - A mixin class for Unix Services
65              
66             =head1 SYNOPSIS
67              
68             use XAS::Class
69             debug => 0,
70             version => $VERSION,
71             base => 'XAS::Lib::App::Service',
72             mixin => 'XAS::Lib::App::Service::Unix',
73             constants => 'TRUE FALSE',
74             filesystem => 'File',
75             accessors => 'daemon service pid',
76             ;
77              
78              
79             =head1 DESCRIPTION
80              
81             This module provides a mixin class to define the necessary functionality for
82             a Service to run on a Unix like box.
83              
84             =head1 METHODS
85              
86             =head2 define_daemon
87              
88             This method will tell POE that the process has forked.
89              
90             =head2 get_service_config
91              
92             This method does nothing on Unix.
93              
94             =head2 install_service
95              
96             This method does nothing on Unix.
97              
98             =head2 remove_service
99              
100             This method does nothing on Unix.
101              
102             =head1 SEE ALSO
103              
104             =over 4
105              
106             =item L<XAS::Lib::App::Service|XAS::Lib::App::Service>
107              
108             =item L<XAS|XAS>
109              
110             =back
111              
112             =head1 AUTHOR
113              
114             Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt>
115              
116             =head1 COPYRIGHT AND LICENSE
117              
118             Copyright (C) 2014 Kevin L. Esteb
119              
120             This is free software; you can redistribute it and/or modify it under
121             the terms of the Artistic License 2.0. For details, see the full text
122             of the license at http://www.perlfoundation.org/artistic_license_2_0.
123              
124             =cut