summaryrefslogtreecommitdiff
path: root/lib/PerlDaemonModules/ExampleModule2.pm
blob: eaa57023d9941764e48064b73f235395437eeba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# PerlDaemon (c) 2010, 2011, 2015, Dipl.-Inform. (FH) Paul Buetow (http://perldaemon.buetow.org)

package PerlDaemonModules::ExampleModule2;

use strict;
use warnings;

sub new ($$$) {
  my ($class, $conf) = @_;

  my $self = bless { conf => $conf }, $class;

        # Store some private persistent module stuff
        $self->{counter} = 0;

  return $self;
}

# Runs periodically in a loop (set interval in perldaemon.conf)
sub do ($) {
  my $self = shift;
  my $conf = $self->{conf};
  my $logger = $conf->{logger};

  # Calculate some private module stuff
  my $count = ++$self->{counter};

  $logger->logmsg("ExampleModule2 Test $count");
}

1;