File Coverage

blib/lib/Acme/Matt/Daemon.pm
Criterion Covered Total %
statement 15 23 65.2
branch n/a
condition n/a
subroutine 5 7 71.4
pod 0 2 0.0
total 20 32 62.5


line stmt bran cond sub pod time code
1             package Acme::Matt::Daemon;
2              
3 1     1   22841 use warnings;
  1         3  
  1         38  
4 1     1   6 use strict;
  1         2  
  1         699  
5              
6             =head1 MATT DAEMON
7              
8             =head1 NAME
9              
10             Acme::Matt::Daemon - MATT DAEMON
11              
12             =head1 VERSION
13              
14             Version 0.01
15              
16             =cut
17              
18             our $VERSION = '0.01';
19              
20 1     1   8 use vars qw/@ISA @EXPORT/;
  1         6  
  1         107  
21             @ISA = qw/Exporter/;
22             @EXPORT = qw/MATT DAEMON DAMON MATTDAMON MATTDAEMON/;
23              
24 1     1   1110 use Log::Syslog::Abstract qw/openlog syslog closelog/;
  1         1596  
  1         8  
25 1     1   35137 use Proc::Daemon;
  1         2837  
  1         247  
26              
27 0     0 0   sub MATT {
28             }
29              
30             my @interval = map { $_ * 60 } qw/15 60/;
31             $interval[1] -= $interval[0];
32              
33             sub DAEMON {
34              
35 0     0 0   print "MATT DAEMON\n";
36              
37 0           Proc::Daemon::Init;
38              
39 0           while (1) {
40 0           openlog( 'matt-daemon', '', 'local0' );
41              
42 0           syslog( 'info', '%s', 'MATT DAEMON' );
43              
44 0           closelog;
45              
46 0           sleep($interval[0] + int rand $interval[1]);
47             }
48             }
49              
50             *DAMON = \&DAEMON;
51             *MATTDAMON = \&DAEMON;
52             *MATTDAEMON = \&DAEMON;
53              
54             =head1 SYNOPSIS
55              
56             MATT DAEMON
57              
58             perl -MAcme::Matt::Daemon -e 'MATT DAEMON'
59              
60             =head1 DESCRIPTION
61              
62             MATT DAEMON
63              
64             L
65              
66             L will daemonize and output MATT DAEMON to your syslog at every 15 to 60 minutes (randomly). Enjoy!
67              
68             =head1 AUTHOR
69              
70             Robert Krimen, C<< >>
71              
72             =head1 BUGS
73              
74             Please report any bugs or feature requests to C, or through
75             the web interface at L. I will be notified, and then you'll
76             automatically be notified of progress on your bug as I make changes.
77              
78              
79              
80              
81             =head1 SUPPORT
82              
83             You can find documentation for this module with the perldoc command.
84              
85             perldoc Acme::Matt::Daemon
86              
87              
88             You can also look for information at:
89              
90             =over 4
91              
92             =item * RT: CPAN's request tracker
93              
94             L
95              
96             =item * AnnoCPAN: Annotated CPAN documentation
97              
98             L
99              
100             =item * CPAN Ratings
101              
102             L
103              
104             =item * Search CPAN
105              
106             L
107              
108             =back
109              
110              
111             =head1 ACKNOWLEDGEMENTS
112              
113              
114             =head1 COPYRIGHT & LICENSE
115              
116             Copyright 2009 Robert Krimen, all rights reserved.
117              
118             This program is free software; you can redistribute it and/or modify it
119             under the same terms as Perl itself.
120              
121             =head1 MATT DAEMON
122              
123             =cut
124              
125             'MATT DAEMON'; # End of Acme::Matt::Daemon