X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=modules%2Ffallback%2FDaemon%2FGeneric%2FEvent.pm;fp=modules%2Ffallback%2FDaemon%2FGeneric%2FEvent.pm;h=0000000000000000000000000000000000000000;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hp=2279a1ee9be0fa77b3f69cc3ad441663b1ad14f9;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44;p=kivitendo-erp.git diff --git a/modules/fallback/Daemon/Generic/Event.pm b/modules/fallback/Daemon/Generic/Event.pm deleted file mode 100644 index 2279a1ee9..000000000 --- a/modules/fallback/Daemon/Generic/Event.pm +++ /dev/null @@ -1,126 +0,0 @@ - -# Copyright (C) 2006, David Muir Sharnoff - -package Daemon::Generic::Event; - -use strict; -use warnings; -require Daemon::Generic; -require Event; -require Exporter; - -our @ISA = qw(Daemon::Generic Exporter); -our @EXPORT = @Daemon::Generic::EXPORT; -our $VERSION = 0.3; - -sub newdaemon -{ - local($Daemon::Generic::caller) = caller() || 'main'; - local($Daemon::Generic::package) = __PACKAGE__; - Daemon::Generic::newdaemon(@_); -} - -sub gd_setup_signals -{ - my $self = shift; - my $reload_event = Event->signal( - signal => 'HUP', - desc => 'reload on SIGHUP', - prio => 6, - cb => sub { - $self->gd_reconfig_event; - $self->{gd_timer}->cancel() - if $self->{gd_timer}; - $self->gd_setup_timer(); - }, - ); - my $quit_event = Event->signal( - signal => 'INT', - cb => sub { $self->gd_quit_event; }, - ); -} - -sub gd_setup_timer -{ - my $self = shift; - if ($self->can('gd_run_body')) { - my $interval = ($self->can('gd_interval') && $self->gd_interval()) || 1; - $self->{gd_timer} = Event->timer( - cb => [ $self, 'gd_run_body' ], - interval => $interval, - hard => 0, - ); - } -} - -sub gd_run -{ - my $self = shift; - $self->gd_setup_timer(); - Event::loop(); -} - -sub gd_quit_event -{ - my $self = shift; - print STDERR "Quitting...\n"; - Event::unloop_all(); -} - -1; - -=head1 NAME - - Daemon::Generic::Event - Generic daemon framework with Event.pm - -=head1 SYNOPSIS - - use Daemon::Generic::Event; - - @ISA = qw(Daemon::Generic::Event); - - sub gd_preconfig { - # stuff - } - -=head1 DESCRIPTION - -Daemon::Generic::Event is a subclass of L that -predefines some methods: - -=over 15 - -=item gd_run() - -Setup a periodic callback to C if there is a C. -Call C. - -=item gd_setup_signals() - -Bind SIGHUP to call C. -Bind SIGINT to call C. - -=back - -To use Daemon::Generic::Event, you have to provide a C -method. It can be empty if you have a C. - -Set up your own events in C and C. - -If you have a C method, it will be called once per -second or every C seconds if you have a C -method. Unlike in L, C should -not include a call to C. - -=head1 THANK THE AUTHOR - -If you need high-speed internet services (T1, T3, OC3 etc), please -send me your request-for-quote. I have access to very good pricing: -you'll save money and get a great service. - -=head1 LICENSE - -Copyright(C) 2006 David Muir Sharnoff . -This module may be used and distributed on the same terms -as Perl itself. -