| 1 | package Acme::Matt::Daemon; | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 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 | use vars qw/@ISA @EXPORT/; | ||
| 21 | @ISA = qw/Exporter/; | ||
| 22 | @EXPORT = qw/MATT DAEMON DAMON MATTDAMON MATTDAEMON/; | ||
| 23 | |||
| 24 | use Log::Syslog::Abstract qw/openlog syslog closelog/; | ||
| 25 | use Proc::Daemon; | ||
| 26 | |||
| 27 | sub MATT { | ||
| 28 | } | ||
| 29 | |||
| 30 | my @interval = map { $_ * 60 } qw/15 60/; | ||
| 31 | $interval[1] -= $interval[0]; | ||
| 32 | |||
| 33 | sub DAEMON { | ||
| 34 | |||
| 35 | print "MATT DAEMON\n"; | ||
| 36 | |||
| 37 | Proc::Daemon::Init; | ||
| 38 | |||
| 39 | while (1) { | ||
| 40 | openlog( 'matt-daemon', '', 'local0' ); | ||
| 41 | |||
| 42 | syslog( 'info', '%s', 'MATT DAEMON' ); | ||
| 43 | |||
| 44 | closelog; | ||
| 45 | |||
| 46 | 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<http://www.youtube.com/watch?v=ZWTzyU5MFgM> | ||
| 65 | |||
| 66 | L<Acme::Matt::Daemon> 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<< <rkrimen at cpan.org> >> | ||
| 71 | |||
| 72 | =head1 BUGS | ||
| 73 | |||
| 74 | Please report any bugs or feature requests to C<bug-acme-matt-daemon at rt.cpan.org>, or through | ||
| 75 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-Matt-Daemon>. 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<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-Matt-Daemon> | ||
| 95 | |||
| 96 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 97 | |||
| 98 | L<http://annocpan.org/dist/Acme-Matt-Daemon> | ||
| 99 | |||
| 100 | =item * CPAN Ratings | ||
| 101 | |||
| 102 | L<http://cpanratings.perl.org/d/Acme-Matt-Daemon> | ||
| 103 | |||
| 104 | =item * Search CPAN | ||
| 105 | |||
| 106 | L<http://search.cpan.org/dist/Acme-Matt-Daemon/> | ||
| 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 |